2016-11-30 06:55:37 +01:00
|
|
|
#include "pxt.h"
|
2016-04-02 06:26:06 +02:00
|
|
|
|
|
|
|
enum class DigitalPin {
|
2017-01-31 22:36:32 +01:00
|
|
|
P0 = MICROBIT_ID_IO_P12, // edge connector 0
|
|
|
|
P1 = MICROBIT_ID_IO_P0, // edge connector 1
|
|
|
|
P2 = MICROBIT_ID_IO_P1, // edge connector 2
|
|
|
|
P3 = MICROBIT_ID_IO_P16, // edge connector 3
|
|
|
|
C4 = MICROBIT_ID_IO_P3, // LED matrix C1
|
|
|
|
C5 = MICROBIT_ID_IO_P4, // LED matrix C2
|
|
|
|
C6 = MICROBIT_ID_IO_P10, // LED matrix C3
|
|
|
|
C7 = MICROBIT_ID_IO_P13, // LED matrix C4
|
|
|
|
C8 = MICROBIT_ID_IO_P14, // LED matrix C5
|
|
|
|
C9 = MICROBIT_ID_IO_P15, // LED matrix C6
|
|
|
|
C10 = MICROBIT_ID_IO_P9, // LED matrix C7
|
|
|
|
C11 = MICROBIT_ID_IO_P7, // LED matrix C8
|
|
|
|
C12 = MICROBIT_ID_IO_P6, // LED matrix C9
|
|
|
|
C16 = MICROBIT_ID_IO_P2, // RX
|
|
|
|
C17 = MICROBIT_ID_IO_P8, // TX
|
|
|
|
C18 = MICROBIT_ID_IO_P20, // SDA
|
|
|
|
C19 = MICROBIT_ID_IO_P19 // SCL
|
2016-04-02 06:26:06 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class AnalogPin {
|
2017-01-31 22:36:32 +01:00
|
|
|
P1 = MICROBIT_ID_IO_P0, // edge connector 1
|
|
|
|
P2 = MICROBIT_ID_IO_P1, // edge connector 2
|
|
|
|
C4 = MICROBIT_ID_IO_P3, // LED matrix C1
|
|
|
|
C5 = MICROBIT_ID_IO_P4, // LED matrix C2
|
|
|
|
C6 = MICROBIT_ID_IO_P10, // LED matrix C3
|
2017-02-20 11:13:00 +01:00
|
|
|
C16 = MICROBIT_ID_IO_P2, // RX
|
|
|
|
C17 = MICROBIT_ID_IO_P8, // TX
|
2017-01-31 22:36:32 +01:00
|
|
|
MIC = MICROBIT_ID_IO_P21 // microphone
|
2016-04-02 06:26:06 +02:00
|
|
|
};
|
|
|
|
|
2016-05-17 01:24:44 +02:00
|
|
|
enum class PulseValue {
|
2019-12-02 05:58:26 +01:00
|
|
|
//% block=high
|
2016-05-17 01:24:44 +02:00
|
|
|
High = MICROBIT_PIN_EVT_PULSE_HI,
|
2019-12-02 05:58:26 +01:00
|
|
|
//% block=low
|
2016-05-17 01:24:44 +02:00
|
|
|
Low = MICROBIT_PIN_EVT_PULSE_LO
|
|
|
|
};
|
|
|
|
|
2016-06-04 08:15:51 +02:00
|
|
|
enum class PinPullMode {
|
|
|
|
//% block="down"
|
|
|
|
PullDown = 0,
|
|
|
|
//% block="up"
|
|
|
|
PullUp = 1,
|
|
|
|
//% block="none"
|
|
|
|
PullNone = 2
|
|
|
|
};
|
|
|
|
|
2017-01-30 20:19:54 +01:00
|
|
|
enum class PinEventType {
|
|
|
|
//% block="edge"
|
|
|
|
Edge = MICROBIT_PIN_EVENT_ON_EDGE,
|
|
|
|
//% block="pulse"
|
|
|
|
Pulse = MICROBIT_PIN_EVENT_ON_PULSE,
|
|
|
|
//% block="touch"
|
|
|
|
Touch = MICROBIT_PIN_EVENT_ON_TOUCH,
|
|
|
|
//% block="none"
|
|
|
|
None = MICROBIT_PIN_EVENT_NONE
|
|
|
|
};
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
|
|
|
|
namespace pxt
|
|
|
|
{
|
2016-04-02 06:26:06 +02:00
|
|
|
MicroBitPin *getPin(int id) {
|
|
|
|
switch (id) {
|
|
|
|
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
|
|
|
case MICROBIT_ID_IO_P1: return &uBit.io.P1;
|
|
|
|
case MICROBIT_ID_IO_P2: return &uBit.io.P2;
|
|
|
|
case MICROBIT_ID_IO_P3: return &uBit.io.P3;
|
|
|
|
case MICROBIT_ID_IO_P4: return &uBit.io.P4;
|
|
|
|
case MICROBIT_ID_IO_P5: return &uBit.io.P5;
|
|
|
|
case MICROBIT_ID_IO_P6: return &uBit.io.P6;
|
|
|
|
case MICROBIT_ID_IO_P7: return &uBit.io.P7;
|
2017-01-31 22:36:32 +01:00
|
|
|
case MICROBIT_ID_IO_P8: return &uBit.io.P8;
|
2016-04-02 06:26:06 +02:00
|
|
|
case MICROBIT_ID_IO_P9: return &uBit.io.P9;
|
|
|
|
case MICROBIT_ID_IO_P10: return &uBit.io.P10;
|
|
|
|
case MICROBIT_ID_IO_P11: return &uBit.io.P11;
|
2017-01-31 22:36:32 +01:00
|
|
|
case MICROBIT_ID_IO_P12: return &uBit.io.P12;
|
|
|
|
case MICROBIT_ID_IO_P13: return &uBit.io.P13;
|
|
|
|
case MICROBIT_ID_IO_P14: return &uBit.io.P14;
|
|
|
|
case MICROBIT_ID_IO_P15: return &uBit.io.P15;
|
|
|
|
case MICROBIT_ID_IO_P16: return &uBit.io.P16;
|
2016-04-02 06:26:06 +02:00
|
|
|
case MICROBIT_ID_IO_P19: return &uBit.io.P19;
|
|
|
|
case MICROBIT_ID_IO_P20: return &uBit.io.P20;
|
2017-01-31 22:36:32 +01:00
|
|
|
case MICROBIT_ID_IO_P21: return &uBit.io.P21;
|
2016-04-02 06:26:06 +02:00
|
|
|
default: return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
} // pxt
|
2016-04-02 06:26:06 +02:00
|
|
|
|
|
|
|
namespace pins {
|
|
|
|
#define PINOP(op) \
|
|
|
|
MicroBitPin *pin = getPin((int)name); \
|
|
|
|
if (!pin) return; \
|
|
|
|
pin->op
|
|
|
|
|
|
|
|
#define PINREAD(op) \
|
|
|
|
MicroBitPin *pin = getPin((int)name); \
|
|
|
|
if (!pin) return 0; \
|
|
|
|
return pin->op
|
|
|
|
|
2016-04-04 02:49:35 +02:00
|
|
|
|
|
|
|
//%
|
|
|
|
MicroBitPin *getPinAddress(int id) {
|
|
|
|
return getPin(id);
|
|
|
|
}
|
|
|
|
|
2016-04-02 06:26:06 +02:00
|
|
|
/**
|
|
|
|
* Read the specified pin or connector as either 0 or 1
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name pin to read from, eg: DigitalPin.P0
|
2016-04-02 06:26:06 +02:00
|
|
|
*/
|
2016-04-02 06:27:22 +02:00
|
|
|
//% help=pins/digital-read-pin weight=30
|
2016-04-02 06:26:06 +02:00
|
|
|
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8
|
2017-12-14 20:00:47 +01:00
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300"
|
2016-04-02 06:26:06 +02:00
|
|
|
int digitalReadPin(DigitalPin name) {
|
|
|
|
PINREAD(getDigitalValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a pin or connector value to either 0 or 1.
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name pin to write to, eg: DigitalPin.P0
|
2016-04-02 06:26:06 +02:00
|
|
|
* @param value value to set on the pin, 1 eg,0
|
|
|
|
*/
|
2016-04-02 06:27:22 +02:00
|
|
|
//% help=pins/digital-write-pin weight=29
|
2016-04-02 06:26:06 +02:00
|
|
|
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% value.min=0 value.max=1
|
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300"
|
2017-01-30 20:19:54 +01:00
|
|
|
void digitalWritePin(DigitalPin name, int value) {
|
2016-04-02 06:26:06 +02:00
|
|
|
PINOP(setDigitalValue(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
|
Update Pins (#62)
* add windows and mac icons for offline app (#2141)
* Don't overwrite electron deploy (#2142)
* remove baud rate as it is not support on HW (#2124)
* add blocks for serial set tx/rx buffer size (#2144)
* support flag argument (#2126)
* support flag argument
* enable drop semantics
* add reentrant
* updated shims
* Bumping pxt-core to 5.15.3
* 1.4.13
* Bumping pxt-core to 5.15.4
* 1.4.14
* bump setgroup on top of radio (#2157)
* bump setgroup on top of radio
* move group up
* Update name-tag.md (#2156)
* add API to disable serial padding. (#2145)
* add API to desiable serial padding.
* renamed api
* Set serial help paths for blocks (#2159)
* Shrink the link in firmware version hint (#2163)
* Shrink the link in firmware version hint
* fix a translation quibble
* Fix Black and White Typo (#2138)
* Fixed typo: Back->Black
* Added Upgrade Rules to fix spelling
* Removed extra isEmpty
* Added previous BackAndWhite to allow for compilation of old scripts
* always shake when button is pressed (#2161)
* add PLENbit (#2140)
* Bumping pxt-core to 5.15.5
* 1.4.15
* stop background before foreground (#2174)
* Bumping pxt-core to 5.15.6
* 1.4.16
* Bumping pxt-core to 5.15.7
* 1.4.17
* Bumping pxt-core to 5.15.8
* 1.4.18
* add backgrounds for use with .dmg (#2200)
* add normal size and 2x size backgrounds for dmg
* update arrow color to dark gray
* Bumping pxt-core to 5.15.9
* 1.4.19
* Adding v1-ref.json pointing to 1.2.13
* Bumping microbit to 2.0.0
* 2.0.1
* Pointing beta-ref to v2
* Bumping pxt-core to 5.15.10
* 2.0.2
* this repo is empty (#2201)
* Update radio event parm usage descriptions (#2165)
* add browser db prefix for v2 (#2208)
* 2.0.3
* Releasing 2.0.3 to live (#2209)
* dynamically sniff offline app version (#2059)
* Revert "dynamically sniff offline app version (#2059)" (#2211)
This reverts commit b480b34f7e8828794297613a12534f54573a3011.
* Updating electron to 2.0.3 (#2210)
* Updating offline reference to 2.0.3 (#2212)
* Bumping version to 2.1.0
* 2.1.1
* Spelling (#2214)
* Update write-received-packet-to-serial.md (#2217)
A support ticket pointed out issues that they'd encountered when trying to follow this document:
- `sendValue` only supports an 8 character string. This is documented in the `sendValue` docs but a longer string had been used here
- Only `radio.onReceivedNumber` is used so the sample output is not consistent with the users experience. I've changed it so that all packets are handled
* Use gcPreAllocateBlock() to fix #2177, #2215 (#2216)
* Use gcPreAllocateBlock() to fix #2177, #2215
* bump pcp 6.9.4
* 2.1.2
* Correct dice example (#2262)
Changed random(6) to random(5) so the number reflect real dice.
* add 4tronix minibit (#2249)
* Update targetconfig.json (#2258)
remove mock-iot-extension as it is just an experimental development by The Foundation
* Update calibrate-compass.md (#2265)
Based on user feedback in Slack https://microbit-community.slack.com/archives/C1ZMKRFHD/p1563274019078400?thread_ts=1563268925.077500&cid=C1ZMKRFHD
* add wukong (#2239)
* Decrease size of GC heap to allow more DAL allocs (#2246)
* 2.1.3
* add Kitronik view text (#2125)
* Release 2.0.6 to live (#2308)
* Update nexus:bit entry (#2315)
* update nexus:bit entry
* update nexus:bit entry
* Logic Lab mini-course (#2307)
* Logic Lab mini-course
* example syntax
* Updating Readme with branch information.
* bump pxt for ios <=9 fix (#2311)
* Update pxt/common-packages and fix build (#2323)
* fix build off of pxt/ and pxt-common-packages master
* check in generated files
* add-pxt-bmp280 (#2325)
* Bumping pxt-core to 5.19.8 & common-packages to 6.14.9
* 2.1.4
* Error codes page update (#2327)
* Start adding new codes
* few tiny edits
* Add more errors and rearrange
* Update docs/device/error-codes.md
Co-Authored-By: Michał Moskal <michal@moskal.me>
* juggle category
* set error range in hint
Co-Authored-By: Michał Moskal <michal@moskal.me>
* Update docs/device/error-codes.md
Co-Authored-By: Mark <mark@microbit.org>
* fix build (#2360)
* fix broken build
* just try the more 'official' fix if possible
* back to the way that actually works..
* bump pxt to include accessibility changes (#2404)
* 2.1.5
* make hc mode sim color have higher contrast (#2409)
* Show project settings (#2401)
* markdown link fix (#2400)
* add HTS221 (#2384)
* Editor controllers fixes (#2412)
* updated strings
* bump pxt
* anotehr attempt
* 2.1.6
* turn on samples when reading accelerometer (#2413)
* 2.1.7
* hide pin p19/p20 (#2268)
* Fix remove life animation causing microbit stuck (#2314)
On the real microbit board, if the program execute other game blocks while
the remove life animation is playing, it would cause strange behavior or
even make the game stuck.
* Port of Programmable Logic lesson for Logic Lab course (#2359)
* port of programmable logic lesson
* trigger rebuild
* express as logical equation in snippet
* go logical for snippet inputs
* emit enum as bitmask (#2414)
* 2.1.8
* add alt attributes to download screens (#2415)
* add alt attributes to download screens, fixes microsoft/pxt-microbit#2291
* better descriptions
* fixing links in translate page
* Modify the LED coordinates to be between 0 and 4. (#2416)
Without this change, there is a 11/36 chance no LED lights as [`Math.random(a,b)`](https://docs.python.org/2/library/random.html#random.uniform) (thus the `pick random` block) chooses a number in the (inclusive, closed) interval `[a, b]`.
* Set LED plot row/column ranges for 'Reaction Time' (#2420)
* add LIS2MDL (#2385)
* add LIS2DW12 (#2386)
* add LPS22 (#2387)
* add LSM6DSO (#2388)
* add gator environment (#2326)
* add STTS751 (#2389)
* add inventura extension (#2421)
* add new sparkfun extensions (#2238)
* add new sparkfun extensions
* remove gator environment pending fixes
* add dfplayer mini extension (#2417)
* Update 'servo calibrator' link (#2424)
* I2C Addressing Note (#2428)
* I2C on-board sensor address note
* note for 7bit to 8bit shift
* Add nested summaries for newer courses (#2425)
* bump pxt (#2432)
* bump pxt
* bump
* bump
* fix version
* 2.1.9
* bump package.json (#2433)
* 2.1.10
* bump pxt (#2434)
* 2.1.11
* bump for diff3 (#2435)
* enable experiment
* bump pxt
* 2.1.12
* Add the Stu Lowe coding cards (#2438)
* Add the Stu Lowe coding cards
* Move 'Coding Cards' below 'Hardware'
* Add isDeleted (#2445)
* add xinabox OD01 and breakout display section (#2397)
* add xinabox OD01 and breakout display section
* Update targetconfig.json
* Update extensions.md
* Link to power supply limitations (#2443)
Fixes: #2442
* Pxt v5.23.17 (#2446)
* bump pxt
* regen docs
* fix version syntax
* restore extension
* removed dup
* 2.1.13
* add-sw01 (#2393)
* Locking old issues
* add Keyestudio robot car (#2452)
* Allow globals in reclaimed bluetooth memory (#2455)
* isTouchingEdge() should not return true for deleted sprite (#2449)
* add query variant to hide toolbar (#2458)
* Adding link to stable refs (#2460)
* Update extensions.md (#2456)
Move the :VIEW Text32 from other to Display now there is a display sections
* 2.1.14
* fixing radio stack (#2461)
* fixing radio stack
* updated shims
* 2.1.15
* Stable points to latest 2.0.9 (#2469)
* Releasing 2.0.9 to live (#2470)
* Fixing signal strength (#2474)
* Pointing to 2.0.10
* Releasing 2.0.10 (#2476)
With radio strength signal fix for hot or cold
* Removing old bitbot as we have a new bitbot package (#2479)
* updated pxt (#2465)
* updated pxt
* bump pxt
* updated react
* updated ptx
* Remove empty variable element from XML
* Bump pxt-core to 5.25.15
* bump pxt
* Bump pxt to 5.25.17
* Add precision to music slider
* 2.1.16
* add drive:bit (#2484)
* micro:bit RSSI fix (#2480)
* read rssi from packet
* updated shims
* fix build
* fix help
* move deprecated function to ts
* some formatting
* restore rssi block
* restory notations
* actually copy bytes
* removing logging code
* simpler wake up code
* comment
* fix build
* bump pxt
* go back to safety
* bump microbit
* restor package.json
* revert jquery v
* use macro
* check length
* bump pxt (#2490)
* 2.1.17
* Use default resize function for microbit gesture dropdown (#2491)
* Name Badge project page (#2477)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* Revert "Name Badge project page (#2477)"
This reverts commit 2e2860632b399485e6b32a2806de34a59c4af9d8.
* add freenove starter kit (#2493)
* radio.setFrequencyBand support (#2495)
* setfrequencyband support
* revert line change
* add bounds check
* Name Badge project page (#2496)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* get rid of the pptx
* Simplify the Fahrenheit from Celsius computation. (#2497)
As the micro:bit introduces floating point arithmetic for both the existing `f = 18 * c / 10 + 32` computation and the new `f = 1.8 * c + 32` computation, there isn't any benefit for the former.
* Enable Polish localization (#2499)
* bump package
* 2.1.18
* shrink maintenance gif
* 2.1.19
* Rotary phone dial (#2502)
* some write up
* adding images
* text
* more text
* adding vids
* adding escape room
* remove newer lesson
* remove .mp4
* Card page edits
* adding image
* adding to toys
* rotary edits
* fix typo
* bump pxt 5.28.7 (#2503)
* bump pxt
* bump to pxt 5.28.8
* 2.1.20
* bump pxt 5.28.9 (#2504)
* 2.1.21
* bump pxt 5.28.10
* 2.1.22
* bump pxt 5.28.11
* 2.1.23
* bump pxt 5.28.12
* 2.1.24
* Update README.md
* robot unicorn (#2512)
* robot unicorn
* Edits to the unicorn
* fix missing radio and boardname
* bump pxt 5.28.18 (#2517)
* bump pxt 5.28.18
* updated summary
* 2.1.25
* bump pxt 5.28.21
* 2.1.26
* bump to pxt5.28.23
* 2.1.27
* Add redirect to pins info to serial heading (#2520)
* Add redirect to pins info to serial heading
* adding links
* vump to pxt 5.28.24
* 2.1.28
* bump to pxt 5.28.26
* 2.1.29
* add build instructions
* updated build notes
* bump pxt 5.28.27
* 2.1.30
* missing svg
* remove crowdin project to disable upload from master branch
* reeanble crowdin, no upload
* 2.1.31
* bump pxt common to 6.16.25
* missing radio package
* Fix GC heap reclamation (#2528)
* bump to pxt 5.28.31
* bump pxt 5.28.32
* 2.1.32
* 2.1.33
* fix typo
* pxt-microbit-next? (#2543)
Since the repo https://github.com/microsoft/pxt-microbit-next doesn't exist, I am assuming that the word `next` is not meant to be here.
* Extensions: Add Inksmith Climate Action Kit (#2535)
* Fixes for typos found in Crowdin - 11252019 (#2538)
* Extension: add Kitronik Halo HD (#2541)
* Extension: Add EBOTICS MIBO (#2542)
* add Bright Wearables Brightboard (#2537)
* Docs: Change default value in Javascript. (#2540)
* Change default value in Javascript.
Per @microbit-mark 's suggestion, add an example of how to change the default interval value by switching to Javascript.
* edits to new example
* bump pxt 5.30.6
* 2.1.34
* update git and vscode settings
* revert changes to 2.1.28
* package-lock
* v2.1.34
* Change Hero Image
* add RVR (#2516)
* Extension: add minicruise (#2545)
* Fix minutes display for 'Digital Watch' project (#2547)
* Fix minutes display for 'Digital Watch' project
* minutes less than 10
* bump pxt
* 2.1.35
* updated pxt
* 2.1.36
* package lock
* Tutorial Typo Fix
* bumppxt
* 2.1.37
* update error guide link (#2554)
* adding radio firefly (#2549)
* Update 'Metal Detector' example (#2559)
* bump pxt
* 2.1.38
* typoFix
* Update Pins
* Add C7, C8 and C9 Serial Pins
* Add C7, C8 and C9 Serial Pins
* Pins update
* Add maqueen (#2560)
* Extensions: Add DFRobot Maqueen
* fix
* revert pin C7, C8 and C9
* add extension doc file
* revert pxt bump
* Docs: Extensions remove headliner
* Remove outdated #ifdef (#2564)
* Extensions: add servobit (#2557)
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
* bump to pxt 5.31.8, common 6.18.2
* 2.1.39
Co-authored-by: Joey Wunderlich <jwunderl@users.noreply.github.com>
Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
Co-authored-by: kimprice <kimberlymprice@ufl.edu>
Co-authored-by: Galen Nickel <v-gani@microsoft.com>
Co-authored-by: Chase Mortensen <C_Mortensen@live.com>
Co-authored-by: Mark <mark@microbit.org>
Co-authored-by: shakao <34112083+shakao@users.noreply.github.com>
Co-authored-by: Danny Yates <danny@codeaholics.org>
Co-authored-by: Sam Kent <32453267+microbit-sam@users.noreply.github.com>
Co-authored-by: Michał Moskal <michal@moskal.me>
Co-authored-by: Daryl Zuniga <Daryl.Zuniga@gmail.com>
Co-authored-by: Eric Kimsey <ekimsey@users.noreply.github.com>
Co-authored-by: Peter Brodersen <peter@ter.dk>
Co-authored-by: Leo <leo881003@gmail.com>
Co-authored-by: Asher Kach <asher.kach@gmail.com>
Co-authored-by: Franklin Tse <FranklinWhale@users.noreply.github.com>
Co-authored-by: Neal McBurnett <nealmcb@gmail.com>
Co-authored-by: Kitronik Ltd <design@kitronik.co.uk>
Co-authored-by: Helen Leigh <48659173+helenleigh@users.noreply.github.com>
Co-authored-by: Gerard Braad <me@gbraad.nl>
Co-authored-by: Nicole Parrot <cleoqc1124@gmail.com>
2020-01-07 22:31:47 +01:00
|
|
|
* @param name pin to write to, eg: AnalogPin.P1
|
2016-04-02 06:26:06 +02:00
|
|
|
*/
|
2016-04-02 06:27:22 +02:00
|
|
|
//% help=pins/analog-read-pin weight=25
|
2017-01-30 20:19:54 +01:00
|
|
|
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="250"
|
2016-04-02 06:26:06 +02:00
|
|
|
int analogReadPin(AnalogPin name) {
|
|
|
|
PINREAD(getAnalogValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the connector value as analog. Value must be comprised between 0 and 1023.
|
Update Pins (#62)
* add windows and mac icons for offline app (#2141)
* Don't overwrite electron deploy (#2142)
* remove baud rate as it is not support on HW (#2124)
* add blocks for serial set tx/rx buffer size (#2144)
* support flag argument (#2126)
* support flag argument
* enable drop semantics
* add reentrant
* updated shims
* Bumping pxt-core to 5.15.3
* 1.4.13
* Bumping pxt-core to 5.15.4
* 1.4.14
* bump setgroup on top of radio (#2157)
* bump setgroup on top of radio
* move group up
* Update name-tag.md (#2156)
* add API to disable serial padding. (#2145)
* add API to desiable serial padding.
* renamed api
* Set serial help paths for blocks (#2159)
* Shrink the link in firmware version hint (#2163)
* Shrink the link in firmware version hint
* fix a translation quibble
* Fix Black and White Typo (#2138)
* Fixed typo: Back->Black
* Added Upgrade Rules to fix spelling
* Removed extra isEmpty
* Added previous BackAndWhite to allow for compilation of old scripts
* always shake when button is pressed (#2161)
* add PLENbit (#2140)
* Bumping pxt-core to 5.15.5
* 1.4.15
* stop background before foreground (#2174)
* Bumping pxt-core to 5.15.6
* 1.4.16
* Bumping pxt-core to 5.15.7
* 1.4.17
* Bumping pxt-core to 5.15.8
* 1.4.18
* add backgrounds for use with .dmg (#2200)
* add normal size and 2x size backgrounds for dmg
* update arrow color to dark gray
* Bumping pxt-core to 5.15.9
* 1.4.19
* Adding v1-ref.json pointing to 1.2.13
* Bumping microbit to 2.0.0
* 2.0.1
* Pointing beta-ref to v2
* Bumping pxt-core to 5.15.10
* 2.0.2
* this repo is empty (#2201)
* Update radio event parm usage descriptions (#2165)
* add browser db prefix for v2 (#2208)
* 2.0.3
* Releasing 2.0.3 to live (#2209)
* dynamically sniff offline app version (#2059)
* Revert "dynamically sniff offline app version (#2059)" (#2211)
This reverts commit b480b34f7e8828794297613a12534f54573a3011.
* Updating electron to 2.0.3 (#2210)
* Updating offline reference to 2.0.3 (#2212)
* Bumping version to 2.1.0
* 2.1.1
* Spelling (#2214)
* Update write-received-packet-to-serial.md (#2217)
A support ticket pointed out issues that they'd encountered when trying to follow this document:
- `sendValue` only supports an 8 character string. This is documented in the `sendValue` docs but a longer string had been used here
- Only `radio.onReceivedNumber` is used so the sample output is not consistent with the users experience. I've changed it so that all packets are handled
* Use gcPreAllocateBlock() to fix #2177, #2215 (#2216)
* Use gcPreAllocateBlock() to fix #2177, #2215
* bump pcp 6.9.4
* 2.1.2
* Correct dice example (#2262)
Changed random(6) to random(5) so the number reflect real dice.
* add 4tronix minibit (#2249)
* Update targetconfig.json (#2258)
remove mock-iot-extension as it is just an experimental development by The Foundation
* Update calibrate-compass.md (#2265)
Based on user feedback in Slack https://microbit-community.slack.com/archives/C1ZMKRFHD/p1563274019078400?thread_ts=1563268925.077500&cid=C1ZMKRFHD
* add wukong (#2239)
* Decrease size of GC heap to allow more DAL allocs (#2246)
* 2.1.3
* add Kitronik view text (#2125)
* Release 2.0.6 to live (#2308)
* Update nexus:bit entry (#2315)
* update nexus:bit entry
* update nexus:bit entry
* Logic Lab mini-course (#2307)
* Logic Lab mini-course
* example syntax
* Updating Readme with branch information.
* bump pxt for ios <=9 fix (#2311)
* Update pxt/common-packages and fix build (#2323)
* fix build off of pxt/ and pxt-common-packages master
* check in generated files
* add-pxt-bmp280 (#2325)
* Bumping pxt-core to 5.19.8 & common-packages to 6.14.9
* 2.1.4
* Error codes page update (#2327)
* Start adding new codes
* few tiny edits
* Add more errors and rearrange
* Update docs/device/error-codes.md
Co-Authored-By: Michał Moskal <michal@moskal.me>
* juggle category
* set error range in hint
Co-Authored-By: Michał Moskal <michal@moskal.me>
* Update docs/device/error-codes.md
Co-Authored-By: Mark <mark@microbit.org>
* fix build (#2360)
* fix broken build
* just try the more 'official' fix if possible
* back to the way that actually works..
* bump pxt to include accessibility changes (#2404)
* 2.1.5
* make hc mode sim color have higher contrast (#2409)
* Show project settings (#2401)
* markdown link fix (#2400)
* add HTS221 (#2384)
* Editor controllers fixes (#2412)
* updated strings
* bump pxt
* anotehr attempt
* 2.1.6
* turn on samples when reading accelerometer (#2413)
* 2.1.7
* hide pin p19/p20 (#2268)
* Fix remove life animation causing microbit stuck (#2314)
On the real microbit board, if the program execute other game blocks while
the remove life animation is playing, it would cause strange behavior or
even make the game stuck.
* Port of Programmable Logic lesson for Logic Lab course (#2359)
* port of programmable logic lesson
* trigger rebuild
* express as logical equation in snippet
* go logical for snippet inputs
* emit enum as bitmask (#2414)
* 2.1.8
* add alt attributes to download screens (#2415)
* add alt attributes to download screens, fixes microsoft/pxt-microbit#2291
* better descriptions
* fixing links in translate page
* Modify the LED coordinates to be between 0 and 4. (#2416)
Without this change, there is a 11/36 chance no LED lights as [`Math.random(a,b)`](https://docs.python.org/2/library/random.html#random.uniform) (thus the `pick random` block) chooses a number in the (inclusive, closed) interval `[a, b]`.
* Set LED plot row/column ranges for 'Reaction Time' (#2420)
* add LIS2MDL (#2385)
* add LIS2DW12 (#2386)
* add LPS22 (#2387)
* add LSM6DSO (#2388)
* add gator environment (#2326)
* add STTS751 (#2389)
* add inventura extension (#2421)
* add new sparkfun extensions (#2238)
* add new sparkfun extensions
* remove gator environment pending fixes
* add dfplayer mini extension (#2417)
* Update 'servo calibrator' link (#2424)
* I2C Addressing Note (#2428)
* I2C on-board sensor address note
* note for 7bit to 8bit shift
* Add nested summaries for newer courses (#2425)
* bump pxt (#2432)
* bump pxt
* bump
* bump
* fix version
* 2.1.9
* bump package.json (#2433)
* 2.1.10
* bump pxt (#2434)
* 2.1.11
* bump for diff3 (#2435)
* enable experiment
* bump pxt
* 2.1.12
* Add the Stu Lowe coding cards (#2438)
* Add the Stu Lowe coding cards
* Move 'Coding Cards' below 'Hardware'
* Add isDeleted (#2445)
* add xinabox OD01 and breakout display section (#2397)
* add xinabox OD01 and breakout display section
* Update targetconfig.json
* Update extensions.md
* Link to power supply limitations (#2443)
Fixes: #2442
* Pxt v5.23.17 (#2446)
* bump pxt
* regen docs
* fix version syntax
* restore extension
* removed dup
* 2.1.13
* add-sw01 (#2393)
* Locking old issues
* add Keyestudio robot car (#2452)
* Allow globals in reclaimed bluetooth memory (#2455)
* isTouchingEdge() should not return true for deleted sprite (#2449)
* add query variant to hide toolbar (#2458)
* Adding link to stable refs (#2460)
* Update extensions.md (#2456)
Move the :VIEW Text32 from other to Display now there is a display sections
* 2.1.14
* fixing radio stack (#2461)
* fixing radio stack
* updated shims
* 2.1.15
* Stable points to latest 2.0.9 (#2469)
* Releasing 2.0.9 to live (#2470)
* Fixing signal strength (#2474)
* Pointing to 2.0.10
* Releasing 2.0.10 (#2476)
With radio strength signal fix for hot or cold
* Removing old bitbot as we have a new bitbot package (#2479)
* updated pxt (#2465)
* updated pxt
* bump pxt
* updated react
* updated ptx
* Remove empty variable element from XML
* Bump pxt-core to 5.25.15
* bump pxt
* Bump pxt to 5.25.17
* Add precision to music slider
* 2.1.16
* add drive:bit (#2484)
* micro:bit RSSI fix (#2480)
* read rssi from packet
* updated shims
* fix build
* fix help
* move deprecated function to ts
* some formatting
* restore rssi block
* restory notations
* actually copy bytes
* removing logging code
* simpler wake up code
* comment
* fix build
* bump pxt
* go back to safety
* bump microbit
* restor package.json
* revert jquery v
* use macro
* check length
* bump pxt (#2490)
* 2.1.17
* Use default resize function for microbit gesture dropdown (#2491)
* Name Badge project page (#2477)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* Revert "Name Badge project page (#2477)"
This reverts commit 2e2860632b399485e6b32a2806de34a59c4af9d8.
* add freenove starter kit (#2493)
* radio.setFrequencyBand support (#2495)
* setfrequencyband support
* revert line change
* add bounds check
* Name Badge project page (#2496)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* get rid of the pptx
* Simplify the Fahrenheit from Celsius computation. (#2497)
As the micro:bit introduces floating point arithmetic for both the existing `f = 18 * c / 10 + 32` computation and the new `f = 1.8 * c + 32` computation, there isn't any benefit for the former.
* Enable Polish localization (#2499)
* bump package
* 2.1.18
* shrink maintenance gif
* 2.1.19
* Rotary phone dial (#2502)
* some write up
* adding images
* text
* more text
* adding vids
* adding escape room
* remove newer lesson
* remove .mp4
* Card page edits
* adding image
* adding to toys
* rotary edits
* fix typo
* bump pxt 5.28.7 (#2503)
* bump pxt
* bump to pxt 5.28.8
* 2.1.20
* bump pxt 5.28.9 (#2504)
* 2.1.21
* bump pxt 5.28.10
* 2.1.22
* bump pxt 5.28.11
* 2.1.23
* bump pxt 5.28.12
* 2.1.24
* Update README.md
* robot unicorn (#2512)
* robot unicorn
* Edits to the unicorn
* fix missing radio and boardname
* bump pxt 5.28.18 (#2517)
* bump pxt 5.28.18
* updated summary
* 2.1.25
* bump pxt 5.28.21
* 2.1.26
* bump to pxt5.28.23
* 2.1.27
* Add redirect to pins info to serial heading (#2520)
* Add redirect to pins info to serial heading
* adding links
* vump to pxt 5.28.24
* 2.1.28
* bump to pxt 5.28.26
* 2.1.29
* add build instructions
* updated build notes
* bump pxt 5.28.27
* 2.1.30
* missing svg
* remove crowdin project to disable upload from master branch
* reeanble crowdin, no upload
* 2.1.31
* bump pxt common to 6.16.25
* missing radio package
* Fix GC heap reclamation (#2528)
* bump to pxt 5.28.31
* bump pxt 5.28.32
* 2.1.32
* 2.1.33
* fix typo
* pxt-microbit-next? (#2543)
Since the repo https://github.com/microsoft/pxt-microbit-next doesn't exist, I am assuming that the word `next` is not meant to be here.
* Extensions: Add Inksmith Climate Action Kit (#2535)
* Fixes for typos found in Crowdin - 11252019 (#2538)
* Extension: add Kitronik Halo HD (#2541)
* Extension: Add EBOTICS MIBO (#2542)
* add Bright Wearables Brightboard (#2537)
* Docs: Change default value in Javascript. (#2540)
* Change default value in Javascript.
Per @microbit-mark 's suggestion, add an example of how to change the default interval value by switching to Javascript.
* edits to new example
* bump pxt 5.30.6
* 2.1.34
* update git and vscode settings
* revert changes to 2.1.28
* package-lock
* v2.1.34
* Change Hero Image
* add RVR (#2516)
* Extension: add minicruise (#2545)
* Fix minutes display for 'Digital Watch' project (#2547)
* Fix minutes display for 'Digital Watch' project
* minutes less than 10
* bump pxt
* 2.1.35
* updated pxt
* 2.1.36
* package lock
* Tutorial Typo Fix
* bumppxt
* 2.1.37
* update error guide link (#2554)
* adding radio firefly (#2549)
* Update 'Metal Detector' example (#2559)
* bump pxt
* 2.1.38
* typoFix
* Update Pins
* Add C7, C8 and C9 Serial Pins
* Add C7, C8 and C9 Serial Pins
* Pins update
* Add maqueen (#2560)
* Extensions: Add DFRobot Maqueen
* fix
* revert pin C7, C8 and C9
* add extension doc file
* revert pxt bump
* Docs: Extensions remove headliner
* Remove outdated #ifdef (#2564)
* Extensions: add servobit (#2557)
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
* bump to pxt 5.31.8, common 6.18.2
* 2.1.39
Co-authored-by: Joey Wunderlich <jwunderl@users.noreply.github.com>
Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
Co-authored-by: kimprice <kimberlymprice@ufl.edu>
Co-authored-by: Galen Nickel <v-gani@microsoft.com>
Co-authored-by: Chase Mortensen <C_Mortensen@live.com>
Co-authored-by: Mark <mark@microbit.org>
Co-authored-by: shakao <34112083+shakao@users.noreply.github.com>
Co-authored-by: Danny Yates <danny@codeaholics.org>
Co-authored-by: Sam Kent <32453267+microbit-sam@users.noreply.github.com>
Co-authored-by: Michał Moskal <michal@moskal.me>
Co-authored-by: Daryl Zuniga <Daryl.Zuniga@gmail.com>
Co-authored-by: Eric Kimsey <ekimsey@users.noreply.github.com>
Co-authored-by: Peter Brodersen <peter@ter.dk>
Co-authored-by: Leo <leo881003@gmail.com>
Co-authored-by: Asher Kach <asher.kach@gmail.com>
Co-authored-by: Franklin Tse <FranklinWhale@users.noreply.github.com>
Co-authored-by: Neal McBurnett <nealmcb@gmail.com>
Co-authored-by: Kitronik Ltd <design@kitronik.co.uk>
Co-authored-by: Helen Leigh <48659173+helenleigh@users.noreply.github.com>
Co-authored-by: Gerard Braad <me@gbraad.nl>
Co-authored-by: Nicole Parrot <cleoqc1124@gmail.com>
2020-01-07 22:31:47 +01:00
|
|
|
* @param name pin name to write to, eg: AnalogPin.P1
|
2016-04-02 06:26:06 +02:00
|
|
|
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
|
|
|
|
*/
|
2016-04-02 06:27:22 +02:00
|
|
|
//% help=pins/analog-write-pin weight=24
|
2016-04-02 06:26:06 +02:00
|
|
|
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
|
2017-12-14 20:00:47 +01:00
|
|
|
//% value.min=0 value.max=1023
|
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="250"
|
2017-01-30 20:19:54 +01:00
|
|
|
void analogWritePin(AnalogPin name, int value) {
|
2016-04-02 06:26:06 +02:00
|
|
|
PINOP(setAnalogValue(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Configure the pulse-width modulation (PWM) period of the analog output in microseconds.
|
2016-04-02 06:26:06 +02:00
|
|
|
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
|
Update Pins (#62)
* add windows and mac icons for offline app (#2141)
* Don't overwrite electron deploy (#2142)
* remove baud rate as it is not support on HW (#2124)
* add blocks for serial set tx/rx buffer size (#2144)
* support flag argument (#2126)
* support flag argument
* enable drop semantics
* add reentrant
* updated shims
* Bumping pxt-core to 5.15.3
* 1.4.13
* Bumping pxt-core to 5.15.4
* 1.4.14
* bump setgroup on top of radio (#2157)
* bump setgroup on top of radio
* move group up
* Update name-tag.md (#2156)
* add API to disable serial padding. (#2145)
* add API to desiable serial padding.
* renamed api
* Set serial help paths for blocks (#2159)
* Shrink the link in firmware version hint (#2163)
* Shrink the link in firmware version hint
* fix a translation quibble
* Fix Black and White Typo (#2138)
* Fixed typo: Back->Black
* Added Upgrade Rules to fix spelling
* Removed extra isEmpty
* Added previous BackAndWhite to allow for compilation of old scripts
* always shake when button is pressed (#2161)
* add PLENbit (#2140)
* Bumping pxt-core to 5.15.5
* 1.4.15
* stop background before foreground (#2174)
* Bumping pxt-core to 5.15.6
* 1.4.16
* Bumping pxt-core to 5.15.7
* 1.4.17
* Bumping pxt-core to 5.15.8
* 1.4.18
* add backgrounds for use with .dmg (#2200)
* add normal size and 2x size backgrounds for dmg
* update arrow color to dark gray
* Bumping pxt-core to 5.15.9
* 1.4.19
* Adding v1-ref.json pointing to 1.2.13
* Bumping microbit to 2.0.0
* 2.0.1
* Pointing beta-ref to v2
* Bumping pxt-core to 5.15.10
* 2.0.2
* this repo is empty (#2201)
* Update radio event parm usage descriptions (#2165)
* add browser db prefix for v2 (#2208)
* 2.0.3
* Releasing 2.0.3 to live (#2209)
* dynamically sniff offline app version (#2059)
* Revert "dynamically sniff offline app version (#2059)" (#2211)
This reverts commit b480b34f7e8828794297613a12534f54573a3011.
* Updating electron to 2.0.3 (#2210)
* Updating offline reference to 2.0.3 (#2212)
* Bumping version to 2.1.0
* 2.1.1
* Spelling (#2214)
* Update write-received-packet-to-serial.md (#2217)
A support ticket pointed out issues that they'd encountered when trying to follow this document:
- `sendValue` only supports an 8 character string. This is documented in the `sendValue` docs but a longer string had been used here
- Only `radio.onReceivedNumber` is used so the sample output is not consistent with the users experience. I've changed it so that all packets are handled
* Use gcPreAllocateBlock() to fix #2177, #2215 (#2216)
* Use gcPreAllocateBlock() to fix #2177, #2215
* bump pcp 6.9.4
* 2.1.2
* Correct dice example (#2262)
Changed random(6) to random(5) so the number reflect real dice.
* add 4tronix minibit (#2249)
* Update targetconfig.json (#2258)
remove mock-iot-extension as it is just an experimental development by The Foundation
* Update calibrate-compass.md (#2265)
Based on user feedback in Slack https://microbit-community.slack.com/archives/C1ZMKRFHD/p1563274019078400?thread_ts=1563268925.077500&cid=C1ZMKRFHD
* add wukong (#2239)
* Decrease size of GC heap to allow more DAL allocs (#2246)
* 2.1.3
* add Kitronik view text (#2125)
* Release 2.0.6 to live (#2308)
* Update nexus:bit entry (#2315)
* update nexus:bit entry
* update nexus:bit entry
* Logic Lab mini-course (#2307)
* Logic Lab mini-course
* example syntax
* Updating Readme with branch information.
* bump pxt for ios <=9 fix (#2311)
* Update pxt/common-packages and fix build (#2323)
* fix build off of pxt/ and pxt-common-packages master
* check in generated files
* add-pxt-bmp280 (#2325)
* Bumping pxt-core to 5.19.8 & common-packages to 6.14.9
* 2.1.4
* Error codes page update (#2327)
* Start adding new codes
* few tiny edits
* Add more errors and rearrange
* Update docs/device/error-codes.md
Co-Authored-By: Michał Moskal <michal@moskal.me>
* juggle category
* set error range in hint
Co-Authored-By: Michał Moskal <michal@moskal.me>
* Update docs/device/error-codes.md
Co-Authored-By: Mark <mark@microbit.org>
* fix build (#2360)
* fix broken build
* just try the more 'official' fix if possible
* back to the way that actually works..
* bump pxt to include accessibility changes (#2404)
* 2.1.5
* make hc mode sim color have higher contrast (#2409)
* Show project settings (#2401)
* markdown link fix (#2400)
* add HTS221 (#2384)
* Editor controllers fixes (#2412)
* updated strings
* bump pxt
* anotehr attempt
* 2.1.6
* turn on samples when reading accelerometer (#2413)
* 2.1.7
* hide pin p19/p20 (#2268)
* Fix remove life animation causing microbit stuck (#2314)
On the real microbit board, if the program execute other game blocks while
the remove life animation is playing, it would cause strange behavior or
even make the game stuck.
* Port of Programmable Logic lesson for Logic Lab course (#2359)
* port of programmable logic lesson
* trigger rebuild
* express as logical equation in snippet
* go logical for snippet inputs
* emit enum as bitmask (#2414)
* 2.1.8
* add alt attributes to download screens (#2415)
* add alt attributes to download screens, fixes microsoft/pxt-microbit#2291
* better descriptions
* fixing links in translate page
* Modify the LED coordinates to be between 0 and 4. (#2416)
Without this change, there is a 11/36 chance no LED lights as [`Math.random(a,b)`](https://docs.python.org/2/library/random.html#random.uniform) (thus the `pick random` block) chooses a number in the (inclusive, closed) interval `[a, b]`.
* Set LED plot row/column ranges for 'Reaction Time' (#2420)
* add LIS2MDL (#2385)
* add LIS2DW12 (#2386)
* add LPS22 (#2387)
* add LSM6DSO (#2388)
* add gator environment (#2326)
* add STTS751 (#2389)
* add inventura extension (#2421)
* add new sparkfun extensions (#2238)
* add new sparkfun extensions
* remove gator environment pending fixes
* add dfplayer mini extension (#2417)
* Update 'servo calibrator' link (#2424)
* I2C Addressing Note (#2428)
* I2C on-board sensor address note
* note for 7bit to 8bit shift
* Add nested summaries for newer courses (#2425)
* bump pxt (#2432)
* bump pxt
* bump
* bump
* fix version
* 2.1.9
* bump package.json (#2433)
* 2.1.10
* bump pxt (#2434)
* 2.1.11
* bump for diff3 (#2435)
* enable experiment
* bump pxt
* 2.1.12
* Add the Stu Lowe coding cards (#2438)
* Add the Stu Lowe coding cards
* Move 'Coding Cards' below 'Hardware'
* Add isDeleted (#2445)
* add xinabox OD01 and breakout display section (#2397)
* add xinabox OD01 and breakout display section
* Update targetconfig.json
* Update extensions.md
* Link to power supply limitations (#2443)
Fixes: #2442
* Pxt v5.23.17 (#2446)
* bump pxt
* regen docs
* fix version syntax
* restore extension
* removed dup
* 2.1.13
* add-sw01 (#2393)
* Locking old issues
* add Keyestudio robot car (#2452)
* Allow globals in reclaimed bluetooth memory (#2455)
* isTouchingEdge() should not return true for deleted sprite (#2449)
* add query variant to hide toolbar (#2458)
* Adding link to stable refs (#2460)
* Update extensions.md (#2456)
Move the :VIEW Text32 from other to Display now there is a display sections
* 2.1.14
* fixing radio stack (#2461)
* fixing radio stack
* updated shims
* 2.1.15
* Stable points to latest 2.0.9 (#2469)
* Releasing 2.0.9 to live (#2470)
* Fixing signal strength (#2474)
* Pointing to 2.0.10
* Releasing 2.0.10 (#2476)
With radio strength signal fix for hot or cold
* Removing old bitbot as we have a new bitbot package (#2479)
* updated pxt (#2465)
* updated pxt
* bump pxt
* updated react
* updated ptx
* Remove empty variable element from XML
* Bump pxt-core to 5.25.15
* bump pxt
* Bump pxt to 5.25.17
* Add precision to music slider
* 2.1.16
* add drive:bit (#2484)
* micro:bit RSSI fix (#2480)
* read rssi from packet
* updated shims
* fix build
* fix help
* move deprecated function to ts
* some formatting
* restore rssi block
* restory notations
* actually copy bytes
* removing logging code
* simpler wake up code
* comment
* fix build
* bump pxt
* go back to safety
* bump microbit
* restor package.json
* revert jquery v
* use macro
* check length
* bump pxt (#2490)
* 2.1.17
* Use default resize function for microbit gesture dropdown (#2491)
* Name Badge project page (#2477)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* Revert "Name Badge project page (#2477)"
This reverts commit 2e2860632b399485e6b32a2806de34a59c4af9d8.
* add freenove starter kit (#2493)
* radio.setFrequencyBand support (#2495)
* setfrequencyband support
* revert line change
* add bounds check
* Name Badge project page (#2496)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* get rid of the pptx
* Simplify the Fahrenheit from Celsius computation. (#2497)
As the micro:bit introduces floating point arithmetic for both the existing `f = 18 * c / 10 + 32` computation and the new `f = 1.8 * c + 32` computation, there isn't any benefit for the former.
* Enable Polish localization (#2499)
* bump package
* 2.1.18
* shrink maintenance gif
* 2.1.19
* Rotary phone dial (#2502)
* some write up
* adding images
* text
* more text
* adding vids
* adding escape room
* remove newer lesson
* remove .mp4
* Card page edits
* adding image
* adding to toys
* rotary edits
* fix typo
* bump pxt 5.28.7 (#2503)
* bump pxt
* bump to pxt 5.28.8
* 2.1.20
* bump pxt 5.28.9 (#2504)
* 2.1.21
* bump pxt 5.28.10
* 2.1.22
* bump pxt 5.28.11
* 2.1.23
* bump pxt 5.28.12
* 2.1.24
* Update README.md
* robot unicorn (#2512)
* robot unicorn
* Edits to the unicorn
* fix missing radio and boardname
* bump pxt 5.28.18 (#2517)
* bump pxt 5.28.18
* updated summary
* 2.1.25
* bump pxt 5.28.21
* 2.1.26
* bump to pxt5.28.23
* 2.1.27
* Add redirect to pins info to serial heading (#2520)
* Add redirect to pins info to serial heading
* adding links
* vump to pxt 5.28.24
* 2.1.28
* bump to pxt 5.28.26
* 2.1.29
* add build instructions
* updated build notes
* bump pxt 5.28.27
* 2.1.30
* missing svg
* remove crowdin project to disable upload from master branch
* reeanble crowdin, no upload
* 2.1.31
* bump pxt common to 6.16.25
* missing radio package
* Fix GC heap reclamation (#2528)
* bump to pxt 5.28.31
* bump pxt 5.28.32
* 2.1.32
* 2.1.33
* fix typo
* pxt-microbit-next? (#2543)
Since the repo https://github.com/microsoft/pxt-microbit-next doesn't exist, I am assuming that the word `next` is not meant to be here.
* Extensions: Add Inksmith Climate Action Kit (#2535)
* Fixes for typos found in Crowdin - 11252019 (#2538)
* Extension: add Kitronik Halo HD (#2541)
* Extension: Add EBOTICS MIBO (#2542)
* add Bright Wearables Brightboard (#2537)
* Docs: Change default value in Javascript. (#2540)
* Change default value in Javascript.
Per @microbit-mark 's suggestion, add an example of how to change the default interval value by switching to Javascript.
* edits to new example
* bump pxt 5.30.6
* 2.1.34
* update git and vscode settings
* revert changes to 2.1.28
* package-lock
* v2.1.34
* Change Hero Image
* add RVR (#2516)
* Extension: add minicruise (#2545)
* Fix minutes display for 'Digital Watch' project (#2547)
* Fix minutes display for 'Digital Watch' project
* minutes less than 10
* bump pxt
* 2.1.35
* updated pxt
* 2.1.36
* package lock
* Tutorial Typo Fix
* bumppxt
* 2.1.37
* update error guide link (#2554)
* adding radio firefly (#2549)
* Update 'Metal Detector' example (#2559)
* bump pxt
* 2.1.38
* typoFix
* Update Pins
* Add C7, C8 and C9 Serial Pins
* Add C7, C8 and C9 Serial Pins
* Pins update
* Add maqueen (#2560)
* Extensions: Add DFRobot Maqueen
* fix
* revert pin C7, C8 and C9
* add extension doc file
* revert pxt bump
* Docs: Extensions remove headliner
* Remove outdated #ifdef (#2564)
* Extensions: add servobit (#2557)
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
* bump to pxt 5.31.8, common 6.18.2
* 2.1.39
Co-authored-by: Joey Wunderlich <jwunderl@users.noreply.github.com>
Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
Co-authored-by: kimprice <kimberlymprice@ufl.edu>
Co-authored-by: Galen Nickel <v-gani@microsoft.com>
Co-authored-by: Chase Mortensen <C_Mortensen@live.com>
Co-authored-by: Mark <mark@microbit.org>
Co-authored-by: shakao <34112083+shakao@users.noreply.github.com>
Co-authored-by: Danny Yates <danny@codeaholics.org>
Co-authored-by: Sam Kent <32453267+microbit-sam@users.noreply.github.com>
Co-authored-by: Michał Moskal <michal@moskal.me>
Co-authored-by: Daryl Zuniga <Daryl.Zuniga@gmail.com>
Co-authored-by: Eric Kimsey <ekimsey@users.noreply.github.com>
Co-authored-by: Peter Brodersen <peter@ter.dk>
Co-authored-by: Leo <leo881003@gmail.com>
Co-authored-by: Asher Kach <asher.kach@gmail.com>
Co-authored-by: Franklin Tse <FranklinWhale@users.noreply.github.com>
Co-authored-by: Neal McBurnett <nealmcb@gmail.com>
Co-authored-by: Kitronik Ltd <design@kitronik.co.uk>
Co-authored-by: Helen Leigh <48659173+helenleigh@users.noreply.github.com>
Co-authored-by: Gerard Braad <me@gbraad.nl>
Co-authored-by: Nicole Parrot <cleoqc1124@gmail.com>
2020-01-07 22:31:47 +01:00
|
|
|
* @param name analog pin to set period to, eg: AnalogPin.P1
|
2016-04-02 06:26:06 +02:00
|
|
|
* @param micros period in micro seconds. eg:20000
|
|
|
|
*/
|
2016-05-25 06:39:57 +02:00
|
|
|
//% help=pins/analog-set-period weight=23 blockGap=8
|
2017-01-30 20:19:54 +01:00
|
|
|
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
|
|
|
|
//% pin.fieldOptions.tooltips="false"
|
2017-01-30 20:19:54 +01:00
|
|
|
void analogSetPeriod(AnalogPin name, int micros) {
|
2016-04-02 06:26:06 +02:00
|
|
|
PINOP(setAnalogPeriodUs(micros));
|
|
|
|
}
|
2017-01-30 20:19:54 +01:00
|
|
|
|
2016-05-17 01:24:44 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Configure the pin as a digital input and generate an event when the pin is pulsed either high or low.
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name digital pin to register to, eg: DigitalPin.P0
|
|
|
|
* @param pulse the value of the pulse, eg: PulseValue.High
|
2016-05-17 01:24:44 +02:00
|
|
|
*/
|
2019-12-02 05:58:26 +01:00
|
|
|
//% help=pins/on-pulsed weight=22 blockGap=16 advanced=true
|
2016-05-17 01:24:44 +02:00
|
|
|
//% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
|
|
|
|
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300"
|
2016-05-17 01:24:44 +02:00
|
|
|
void onPulsed(DigitalPin name, PulseValue pulse, Action body) {
|
|
|
|
MicroBitPin* pin = getPin((int)name);
|
|
|
|
if (!pin) return;
|
2017-01-30 20:19:54 +01:00
|
|
|
|
|
|
|
pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
|
2016-05-17 01:24:44 +02:00
|
|
|
registerWithDal((int)name, (int)pulse, body);
|
|
|
|
}
|
2017-01-30 20:19:54 +01:00
|
|
|
|
2016-05-17 01:24:44 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Get the duration of the last pulse in microseconds. This function should be called from a ``onPulsed`` handler.
|
2016-05-17 01:24:44 +02:00
|
|
|
*/
|
2017-12-14 20:00:47 +01:00
|
|
|
//% help=pins/pulse-duration advanced=true
|
2016-05-25 06:39:57 +02:00
|
|
|
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
2016-08-17 20:18:15 +02:00
|
|
|
//% weight=21 blockGap=8
|
2016-05-17 01:24:44 +02:00
|
|
|
int pulseDuration() {
|
|
|
|
return pxt::lastEvent.timestamp;
|
|
|
|
}
|
2016-04-02 06:26:06 +02:00
|
|
|
|
2016-08-17 20:18:15 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Return the duration of a pulse at a pin in microseconds.
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name the pin which measures the pulse, eg: DigitalPin.P0
|
|
|
|
* @param value the value of the pulse, eg: PulseValue.High
|
2019-12-02 05:58:26 +01:00
|
|
|
* @param maximum duration in microseconds
|
2017-01-30 20:19:54 +01:00
|
|
|
*/
|
2016-08-17 20:35:54 +02:00
|
|
|
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% weight=20 advanced=true
|
|
|
|
//% help=pins/pulse-in
|
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="300"
|
2016-08-17 20:35:54 +02:00
|
|
|
int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) {
|
2016-08-17 20:18:15 +02:00
|
|
|
MicroBitPin* pin = getPin((int)name);
|
|
|
|
if (!pin) return 0;
|
|
|
|
|
|
|
|
int pulse = value == PulseValue::High ? 1 : 0;
|
2017-01-30 20:19:54 +01:00
|
|
|
uint64_t tick = system_timer_current_time_us();
|
|
|
|
uint64_t maxd = (uint64_t)maxDuration;
|
2016-08-17 20:35:54 +02:00
|
|
|
while(pin->getDigitalValue() != pulse) {
|
|
|
|
if(system_timer_current_time_us() - tick > maxd)
|
2017-01-30 20:19:54 +01:00
|
|
|
return 0;
|
2016-08-17 20:35:54 +02:00
|
|
|
}
|
2016-08-17 20:18:15 +02:00
|
|
|
|
2017-01-30 20:19:54 +01:00
|
|
|
uint64_t start = system_timer_current_time_us();
|
2016-08-17 20:35:54 +02:00
|
|
|
while(pin->getDigitalValue() == pulse) {
|
|
|
|
if(system_timer_current_time_us() - tick > maxd)
|
2017-01-30 20:19:54 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
uint64_t end = system_timer_current_time_us();
|
|
|
|
return end - start;
|
2016-08-17 20:18:15 +02:00
|
|
|
}
|
|
|
|
|
2017-10-08 17:26:52 +02:00
|
|
|
// TODO FIX THIS IN THE DAL!
|
|
|
|
inline void fixMotorIssue(AnalogPin name) {
|
|
|
|
NRF_TIMER2->SHORTS = TIMER_SHORTS_COMPARE3_CLEAR_Msk;
|
|
|
|
NRF_TIMER2->INTENCLR = TIMER_INTENCLR_COMPARE3_Msk;
|
|
|
|
NRF_TIMER2->PRESCALER = 4;
|
|
|
|
NRF_TIMER2->CC[3] = 20000;
|
|
|
|
NRF_TIMER2->TASKS_START = 1;
|
|
|
|
NRF_TIMER2->EVENTS_COMPARE[3] = 0;
|
|
|
|
PINOP(getDigitalValue());
|
|
|
|
}
|
|
|
|
|
2016-04-02 06:26:06 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Write a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
Update Pins (#62)
* add windows and mac icons for offline app (#2141)
* Don't overwrite electron deploy (#2142)
* remove baud rate as it is not support on HW (#2124)
* add blocks for serial set tx/rx buffer size (#2144)
* support flag argument (#2126)
* support flag argument
* enable drop semantics
* add reentrant
* updated shims
* Bumping pxt-core to 5.15.3
* 1.4.13
* Bumping pxt-core to 5.15.4
* 1.4.14
* bump setgroup on top of radio (#2157)
* bump setgroup on top of radio
* move group up
* Update name-tag.md (#2156)
* add API to disable serial padding. (#2145)
* add API to desiable serial padding.
* renamed api
* Set serial help paths for blocks (#2159)
* Shrink the link in firmware version hint (#2163)
* Shrink the link in firmware version hint
* fix a translation quibble
* Fix Black and White Typo (#2138)
* Fixed typo: Back->Black
* Added Upgrade Rules to fix spelling
* Removed extra isEmpty
* Added previous BackAndWhite to allow for compilation of old scripts
* always shake when button is pressed (#2161)
* add PLENbit (#2140)
* Bumping pxt-core to 5.15.5
* 1.4.15
* stop background before foreground (#2174)
* Bumping pxt-core to 5.15.6
* 1.4.16
* Bumping pxt-core to 5.15.7
* 1.4.17
* Bumping pxt-core to 5.15.8
* 1.4.18
* add backgrounds for use with .dmg (#2200)
* add normal size and 2x size backgrounds for dmg
* update arrow color to dark gray
* Bumping pxt-core to 5.15.9
* 1.4.19
* Adding v1-ref.json pointing to 1.2.13
* Bumping microbit to 2.0.0
* 2.0.1
* Pointing beta-ref to v2
* Bumping pxt-core to 5.15.10
* 2.0.2
* this repo is empty (#2201)
* Update radio event parm usage descriptions (#2165)
* add browser db prefix for v2 (#2208)
* 2.0.3
* Releasing 2.0.3 to live (#2209)
* dynamically sniff offline app version (#2059)
* Revert "dynamically sniff offline app version (#2059)" (#2211)
This reverts commit b480b34f7e8828794297613a12534f54573a3011.
* Updating electron to 2.0.3 (#2210)
* Updating offline reference to 2.0.3 (#2212)
* Bumping version to 2.1.0
* 2.1.1
* Spelling (#2214)
* Update write-received-packet-to-serial.md (#2217)
A support ticket pointed out issues that they'd encountered when trying to follow this document:
- `sendValue` only supports an 8 character string. This is documented in the `sendValue` docs but a longer string had been used here
- Only `radio.onReceivedNumber` is used so the sample output is not consistent with the users experience. I've changed it so that all packets are handled
* Use gcPreAllocateBlock() to fix #2177, #2215 (#2216)
* Use gcPreAllocateBlock() to fix #2177, #2215
* bump pcp 6.9.4
* 2.1.2
* Correct dice example (#2262)
Changed random(6) to random(5) so the number reflect real dice.
* add 4tronix minibit (#2249)
* Update targetconfig.json (#2258)
remove mock-iot-extension as it is just an experimental development by The Foundation
* Update calibrate-compass.md (#2265)
Based on user feedback in Slack https://microbit-community.slack.com/archives/C1ZMKRFHD/p1563274019078400?thread_ts=1563268925.077500&cid=C1ZMKRFHD
* add wukong (#2239)
* Decrease size of GC heap to allow more DAL allocs (#2246)
* 2.1.3
* add Kitronik view text (#2125)
* Release 2.0.6 to live (#2308)
* Update nexus:bit entry (#2315)
* update nexus:bit entry
* update nexus:bit entry
* Logic Lab mini-course (#2307)
* Logic Lab mini-course
* example syntax
* Updating Readme with branch information.
* bump pxt for ios <=9 fix (#2311)
* Update pxt/common-packages and fix build (#2323)
* fix build off of pxt/ and pxt-common-packages master
* check in generated files
* add-pxt-bmp280 (#2325)
* Bumping pxt-core to 5.19.8 & common-packages to 6.14.9
* 2.1.4
* Error codes page update (#2327)
* Start adding new codes
* few tiny edits
* Add more errors and rearrange
* Update docs/device/error-codes.md
Co-Authored-By: Michał Moskal <michal@moskal.me>
* juggle category
* set error range in hint
Co-Authored-By: Michał Moskal <michal@moskal.me>
* Update docs/device/error-codes.md
Co-Authored-By: Mark <mark@microbit.org>
* fix build (#2360)
* fix broken build
* just try the more 'official' fix if possible
* back to the way that actually works..
* bump pxt to include accessibility changes (#2404)
* 2.1.5
* make hc mode sim color have higher contrast (#2409)
* Show project settings (#2401)
* markdown link fix (#2400)
* add HTS221 (#2384)
* Editor controllers fixes (#2412)
* updated strings
* bump pxt
* anotehr attempt
* 2.1.6
* turn on samples when reading accelerometer (#2413)
* 2.1.7
* hide pin p19/p20 (#2268)
* Fix remove life animation causing microbit stuck (#2314)
On the real microbit board, if the program execute other game blocks while
the remove life animation is playing, it would cause strange behavior or
even make the game stuck.
* Port of Programmable Logic lesson for Logic Lab course (#2359)
* port of programmable logic lesson
* trigger rebuild
* express as logical equation in snippet
* go logical for snippet inputs
* emit enum as bitmask (#2414)
* 2.1.8
* add alt attributes to download screens (#2415)
* add alt attributes to download screens, fixes microsoft/pxt-microbit#2291
* better descriptions
* fixing links in translate page
* Modify the LED coordinates to be between 0 and 4. (#2416)
Without this change, there is a 11/36 chance no LED lights as [`Math.random(a,b)`](https://docs.python.org/2/library/random.html#random.uniform) (thus the `pick random` block) chooses a number in the (inclusive, closed) interval `[a, b]`.
* Set LED plot row/column ranges for 'Reaction Time' (#2420)
* add LIS2MDL (#2385)
* add LIS2DW12 (#2386)
* add LPS22 (#2387)
* add LSM6DSO (#2388)
* add gator environment (#2326)
* add STTS751 (#2389)
* add inventura extension (#2421)
* add new sparkfun extensions (#2238)
* add new sparkfun extensions
* remove gator environment pending fixes
* add dfplayer mini extension (#2417)
* Update 'servo calibrator' link (#2424)
* I2C Addressing Note (#2428)
* I2C on-board sensor address note
* note for 7bit to 8bit shift
* Add nested summaries for newer courses (#2425)
* bump pxt (#2432)
* bump pxt
* bump
* bump
* fix version
* 2.1.9
* bump package.json (#2433)
* 2.1.10
* bump pxt (#2434)
* 2.1.11
* bump for diff3 (#2435)
* enable experiment
* bump pxt
* 2.1.12
* Add the Stu Lowe coding cards (#2438)
* Add the Stu Lowe coding cards
* Move 'Coding Cards' below 'Hardware'
* Add isDeleted (#2445)
* add xinabox OD01 and breakout display section (#2397)
* add xinabox OD01 and breakout display section
* Update targetconfig.json
* Update extensions.md
* Link to power supply limitations (#2443)
Fixes: #2442
* Pxt v5.23.17 (#2446)
* bump pxt
* regen docs
* fix version syntax
* restore extension
* removed dup
* 2.1.13
* add-sw01 (#2393)
* Locking old issues
* add Keyestudio robot car (#2452)
* Allow globals in reclaimed bluetooth memory (#2455)
* isTouchingEdge() should not return true for deleted sprite (#2449)
* add query variant to hide toolbar (#2458)
* Adding link to stable refs (#2460)
* Update extensions.md (#2456)
Move the :VIEW Text32 from other to Display now there is a display sections
* 2.1.14
* fixing radio stack (#2461)
* fixing radio stack
* updated shims
* 2.1.15
* Stable points to latest 2.0.9 (#2469)
* Releasing 2.0.9 to live (#2470)
* Fixing signal strength (#2474)
* Pointing to 2.0.10
* Releasing 2.0.10 (#2476)
With radio strength signal fix for hot or cold
* Removing old bitbot as we have a new bitbot package (#2479)
* updated pxt (#2465)
* updated pxt
* bump pxt
* updated react
* updated ptx
* Remove empty variable element from XML
* Bump pxt-core to 5.25.15
* bump pxt
* Bump pxt to 5.25.17
* Add precision to music slider
* 2.1.16
* add drive:bit (#2484)
* micro:bit RSSI fix (#2480)
* read rssi from packet
* updated shims
* fix build
* fix help
* move deprecated function to ts
* some formatting
* restore rssi block
* restory notations
* actually copy bytes
* removing logging code
* simpler wake up code
* comment
* fix build
* bump pxt
* go back to safety
* bump microbit
* restor package.json
* revert jquery v
* use macro
* check length
* bump pxt (#2490)
* 2.1.17
* Use default resize function for microbit gesture dropdown (#2491)
* Name Badge project page (#2477)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* Revert "Name Badge project page (#2477)"
This reverts commit 2e2860632b399485e6b32a2806de34a59c4af9d8.
* add freenove starter kit (#2493)
* radio.setFrequencyBand support (#2495)
* setfrequencyband support
* revert line change
* add bounds check
* Name Badge project page (#2496)
* Name Bagde project page
* gotta please the summary check
* link typo, ugh
* get rid of the pptx
* Simplify the Fahrenheit from Celsius computation. (#2497)
As the micro:bit introduces floating point arithmetic for both the existing `f = 18 * c / 10 + 32` computation and the new `f = 1.8 * c + 32` computation, there isn't any benefit for the former.
* Enable Polish localization (#2499)
* bump package
* 2.1.18
* shrink maintenance gif
* 2.1.19
* Rotary phone dial (#2502)
* some write up
* adding images
* text
* more text
* adding vids
* adding escape room
* remove newer lesson
* remove .mp4
* Card page edits
* adding image
* adding to toys
* rotary edits
* fix typo
* bump pxt 5.28.7 (#2503)
* bump pxt
* bump to pxt 5.28.8
* 2.1.20
* bump pxt 5.28.9 (#2504)
* 2.1.21
* bump pxt 5.28.10
* 2.1.22
* bump pxt 5.28.11
* 2.1.23
* bump pxt 5.28.12
* 2.1.24
* Update README.md
* robot unicorn (#2512)
* robot unicorn
* Edits to the unicorn
* fix missing radio and boardname
* bump pxt 5.28.18 (#2517)
* bump pxt 5.28.18
* updated summary
* 2.1.25
* bump pxt 5.28.21
* 2.1.26
* bump to pxt5.28.23
* 2.1.27
* Add redirect to pins info to serial heading (#2520)
* Add redirect to pins info to serial heading
* adding links
* vump to pxt 5.28.24
* 2.1.28
* bump to pxt 5.28.26
* 2.1.29
* add build instructions
* updated build notes
* bump pxt 5.28.27
* 2.1.30
* missing svg
* remove crowdin project to disable upload from master branch
* reeanble crowdin, no upload
* 2.1.31
* bump pxt common to 6.16.25
* missing radio package
* Fix GC heap reclamation (#2528)
* bump to pxt 5.28.31
* bump pxt 5.28.32
* 2.1.32
* 2.1.33
* fix typo
* pxt-microbit-next? (#2543)
Since the repo https://github.com/microsoft/pxt-microbit-next doesn't exist, I am assuming that the word `next` is not meant to be here.
* Extensions: Add Inksmith Climate Action Kit (#2535)
* Fixes for typos found in Crowdin - 11252019 (#2538)
* Extension: add Kitronik Halo HD (#2541)
* Extension: Add EBOTICS MIBO (#2542)
* add Bright Wearables Brightboard (#2537)
* Docs: Change default value in Javascript. (#2540)
* Change default value in Javascript.
Per @microbit-mark 's suggestion, add an example of how to change the default interval value by switching to Javascript.
* edits to new example
* bump pxt 5.30.6
* 2.1.34
* update git and vscode settings
* revert changes to 2.1.28
* package-lock
* v2.1.34
* Change Hero Image
* add RVR (#2516)
* Extension: add minicruise (#2545)
* Fix minutes display for 'Digital Watch' project (#2547)
* Fix minutes display for 'Digital Watch' project
* minutes less than 10
* bump pxt
* 2.1.35
* updated pxt
* 2.1.36
* package lock
* Tutorial Typo Fix
* bumppxt
* 2.1.37
* update error guide link (#2554)
* adding radio firefly (#2549)
* Update 'Metal Detector' example (#2559)
* bump pxt
* 2.1.38
* typoFix
* Update Pins
* Add C7, C8 and C9 Serial Pins
* Add C7, C8 and C9 Serial Pins
* Pins update
* Add maqueen (#2560)
* Extensions: Add DFRobot Maqueen
* fix
* revert pin C7, C8 and C9
* add extension doc file
* revert pxt bump
* Docs: Extensions remove headliner
* Remove outdated #ifdef (#2564)
* Extensions: add servobit (#2557)
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
* bump to pxt 5.31.8, common 6.18.2
* 2.1.39
Co-authored-by: Joey Wunderlich <jwunderl@users.noreply.github.com>
Co-authored-by: Richard Knoll <riknoll@users.noreply.github.com>
Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
Co-authored-by: Abhijith Chatra <abchatra@microsoft.com>
Co-authored-by: kimprice <kimberlymprice@ufl.edu>
Co-authored-by: Galen Nickel <v-gani@microsoft.com>
Co-authored-by: Chase Mortensen <C_Mortensen@live.com>
Co-authored-by: Mark <mark@microbit.org>
Co-authored-by: shakao <34112083+shakao@users.noreply.github.com>
Co-authored-by: Danny Yates <danny@codeaholics.org>
Co-authored-by: Sam Kent <32453267+microbit-sam@users.noreply.github.com>
Co-authored-by: Michał Moskal <michal@moskal.me>
Co-authored-by: Daryl Zuniga <Daryl.Zuniga@gmail.com>
Co-authored-by: Eric Kimsey <ekimsey@users.noreply.github.com>
Co-authored-by: Peter Brodersen <peter@ter.dk>
Co-authored-by: Leo <leo881003@gmail.com>
Co-authored-by: Asher Kach <asher.kach@gmail.com>
Co-authored-by: Franklin Tse <FranklinWhale@users.noreply.github.com>
Co-authored-by: Neal McBurnett <nealmcb@gmail.com>
Co-authored-by: Kitronik Ltd <design@kitronik.co.uk>
Co-authored-by: Helen Leigh <48659173+helenleigh@users.noreply.github.com>
Co-authored-by: Gerard Braad <me@gbraad.nl>
Co-authored-by: Nicole Parrot <cleoqc1124@gmail.com>
2020-01-07 22:31:47 +01:00
|
|
|
* @param name pin to write to, eg: AnalogPin.P1
|
2016-04-02 06:26:06 +02:00
|
|
|
* @param value angle or rotation speed, eg:180,90,0
|
|
|
|
*/
|
2016-04-02 06:27:22 +02:00
|
|
|
//% help=pins/servo-write-pin weight=20
|
2016-04-02 06:26:06 +02:00
|
|
|
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
|
2016-11-01 16:16:03 +01:00
|
|
|
//% parts=microservo trackArgs=0
|
2017-12-14 20:00:47 +01:00
|
|
|
//% value.min=0 value.max=180
|
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="250"
|
2017-01-30 20:19:54 +01:00
|
|
|
void servoWritePin(AnalogPin name, int value) {
|
2017-10-08 17:26:52 +02:00
|
|
|
fixMotorIssue(name);
|
2016-04-02 06:26:06 +02:00
|
|
|
PINOP(setServoValue(value));
|
|
|
|
}
|
|
|
|
|
2020-02-15 22:16:34 +01:00
|
|
|
/**
|
|
|
|
* Specifies that a continuous servo is connected.
|
|
|
|
*/
|
|
|
|
//%
|
|
|
|
void servoSetContinuous(AnalogPin name, bool value) {
|
|
|
|
// handled in simulator
|
|
|
|
}
|
|
|
|
|
2016-04-02 06:26:06 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Configure the IO pin as an analog/pwm output and set a pulse width. The period is 20 ms period and the pulse width is set based on the value given in **microseconds** or `1/1000` milliseconds.
|
2016-04-02 06:26:06 +02:00
|
|
|
* @param name pin name
|
|
|
|
* @param micros pulse duration in micro seconds, eg:1500
|
|
|
|
*/
|
2016-08-10 22:10:40 +02:00
|
|
|
//% help=pins/servo-set-pulse weight=19
|
2016-04-02 06:26:06 +02:00
|
|
|
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% value.fieldEditor="gridpicker" value.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% value.fieldOptions.tooltips="false" value.fieldOptions.width="250"
|
2017-01-30 20:19:54 +01:00
|
|
|
void servoSetPulse(AnalogPin name, int micros) {
|
2017-10-08 17:26:52 +02:00
|
|
|
fixMotorIssue(name);
|
2016-04-02 06:26:06 +02:00
|
|
|
PINOP(setServoPulseUs(micros));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MicroBitPin* pitchPin = NULL;
|
|
|
|
|
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Set the pin used when using analog pitch or music.
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name pin to modulate pitch from
|
2016-04-02 06:26:06 +02:00
|
|
|
*/
|
2017-01-30 20:19:54 +01:00
|
|
|
//% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% help=pins/analog-set-pitch-pin weight=3 advanced=true
|
|
|
|
//% name.fieldEditor="gridpicker" name.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% name.fieldOptions.tooltips="false" name.fieldOptions.width="250"
|
2017-01-30 20:19:54 +01:00
|
|
|
void analogSetPitchPin(AnalogPin name) {
|
2019-12-02 05:58:26 +01:00
|
|
|
pitchPin = getPin((int)name);
|
|
|
|
}
|
|
|
|
|
2016-04-02 06:26:06 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Emit a plse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.
|
|
|
|
* @param frequency frequency to modulate in Hz.
|
|
|
|
* @param ms duration of the pitch in milli seconds.
|
|
|
|
*/
|
2017-01-30 20:19:54 +01:00
|
|
|
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
|
|
|
|
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8
|
|
|
|
void analogPitch(int frequency, int ms) {
|
2017-12-14 20:00:47 +01:00
|
|
|
if (pitchPin == NULL)
|
|
|
|
analogSetPitchPin(AnalogPin::P1);
|
|
|
|
if (frequency <= 0) {
|
2019-12-02 05:58:26 +01:00
|
|
|
pitchPin->setAnalogValue(0);
|
|
|
|
} else {
|
|
|
|
pitchPin->setAnalogValue(512);
|
|
|
|
pitchPin->setAnalogPeriodUs(1000000/frequency);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ms > 0) {
|
|
|
|
fiber_sleep(ms);
|
2017-12-14 20:00:47 +01:00
|
|
|
pitchPin->setAnalogValue(0);
|
|
|
|
// TODO why do we use wait_ms() here? it's a busy wait I think
|
|
|
|
wait_ms(5);
|
|
|
|
}
|
2016-04-02 06:26:06 +02:00
|
|
|
}
|
2019-12-02 05:58:26 +01:00
|
|
|
|
2017-01-30 20:19:54 +01:00
|
|
|
|
2016-06-04 08:15:51 +02:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Configure the pull directiion of of a pin.
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param name pin to set the pull mode on, eg: DigitalPin.P0
|
|
|
|
* @param pull one of the mbed pull configurations, eg: PinPullMode.PullUp
|
2016-06-04 08:15:51 +02:00
|
|
|
*/
|
2017-12-14 20:00:47 +01:00
|
|
|
//% help=pins/set-pull weight=3 advanced=true
|
2016-06-04 08:15:51 +02:00
|
|
|
//% blockId=device_set_pull block="set pull|pin %pin|to %pull"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
|
|
|
|
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300"
|
2016-06-04 08:15:51 +02:00
|
|
|
void setPull(DigitalPin name, PinPullMode pull) {
|
2017-01-30 20:19:54 +01:00
|
|
|
PinMode m = pull == PinPullMode::PullDown
|
2016-06-04 08:15:51 +02:00
|
|
|
? PinMode::PullDown
|
2017-01-30 20:19:54 +01:00
|
|
|
: pull == PinPullMode::PullUp ? PinMode::PullUp
|
2016-06-04 08:15:51 +02:00
|
|
|
: PinMode::PullNone;
|
|
|
|
PINOP(setPull(m));
|
|
|
|
}
|
|
|
|
|
2017-01-30 20:19:54 +01:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Configure the events emitted by this pin. Events can be subscribed to
|
2017-01-30 20:19:54 +01:00
|
|
|
* using ``control.onEvent()``.
|
|
|
|
* @param name pin to set the event mode on, eg: DigitalPin.P0
|
|
|
|
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
|
|
|
|
*/
|
|
|
|
//% help=pins/set-events weight=4 advanced=true
|
|
|
|
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% pin.fieldEditor="gridpicker" pin.fieldOptions.columns=4
|
|
|
|
//% pin.fieldOptions.tooltips="false" pin.fieldOptions.width="300"
|
2017-01-30 20:19:54 +01:00
|
|
|
void setEvents(DigitalPin name, PinEventType type) {
|
|
|
|
getPin((int)name)->eventOn((int)type);
|
|
|
|
}
|
|
|
|
|
2016-04-04 01:52:57 +02:00
|
|
|
/**
|
|
|
|
* Create a new zero-initialized buffer.
|
|
|
|
* @param size number of bytes in the buffer
|
|
|
|
*/
|
|
|
|
//%
|
|
|
|
Buffer createBuffer(int size)
|
|
|
|
{
|
2019-12-02 05:58:26 +01:00
|
|
|
return mkBuffer(NULL, size);
|
2016-04-04 01:52:57 +02:00
|
|
|
}
|
2016-04-02 22:44:29 +02:00
|
|
|
|
2016-04-05 04:02:40 +02:00
|
|
|
/**
|
|
|
|
* Read `size` bytes from a 7-bit I2C `address`.
|
|
|
|
*/
|
2016-04-05 04:11:33 +02:00
|
|
|
//%
|
|
|
|
Buffer i2cReadBuffer(int address, int size, bool repeat = false)
|
2016-04-02 22:44:29 +02:00
|
|
|
{
|
2016-04-05 04:02:40 +02:00
|
|
|
Buffer buf = createBuffer(size);
|
2019-12-02 05:58:26 +01:00
|
|
|
uBit.i2c.read(address << 1, (char*)buf->data, size, repeat);
|
2016-04-05 04:02:40 +02:00
|
|
|
return buf;
|
2016-04-02 22:44:29 +02:00
|
|
|
}
|
2017-01-30 20:19:54 +01:00
|
|
|
|
2016-04-05 04:02:40 +02:00
|
|
|
/**
|
|
|
|
* Write bytes to a 7-bit I2C `address`.
|
|
|
|
*/
|
2016-04-05 04:11:33 +02:00
|
|
|
//%
|
2019-12-02 05:58:26 +01:00
|
|
|
int i2cWriteBuffer(int address, Buffer buf, bool repeat = false)
|
2016-04-02 22:44:29 +02:00
|
|
|
{
|
2019-12-02 05:58:26 +01:00
|
|
|
return uBit.i2c.write(address << 1, (char*)buf->data, buf->length, repeat);
|
2016-04-02 22:44:29 +02:00
|
|
|
}
|
2019-12-02 05:58:26 +01:00
|
|
|
|
2016-08-11 08:26:58 +02:00
|
|
|
SPI* spi = NULL;
|
|
|
|
SPI* allocSPI() {
|
2017-12-14 20:00:47 +01:00
|
|
|
if (NULL == spi)
|
2016-08-11 08:26:58 +02:00
|
|
|
spi = new SPI(MOSI, MISO, SCK);
|
|
|
|
return spi;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write to the SPI slave and return the response
|
|
|
|
* @param value Data to be sent to the SPI slave
|
|
|
|
*/
|
2017-12-14 20:00:47 +01:00
|
|
|
//% help=pins/spi-write weight=5 advanced=true
|
2016-08-11 08:26:58 +02:00
|
|
|
//% blockId=spi_write block="spi write %value"
|
|
|
|
int spiWrite(int value) {
|
|
|
|
auto p = allocSPI();
|
|
|
|
return p->write(value);
|
|
|
|
}
|
2017-01-30 20:19:54 +01:00
|
|
|
|
2017-12-14 20:00:47 +01:00
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Set the SPI frequency
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param frequency the clock frequency, eg: 1000000
|
|
|
|
*/
|
|
|
|
//% help=pins/spi-frequency weight=4 advanced=true
|
|
|
|
//% blockId=spi_frequency block="spi frequency %frequency"
|
|
|
|
void spiFrequency(int frequency) {
|
|
|
|
auto p = allocSPI();
|
|
|
|
p->frequency(frequency);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Set the SPI bits and mode
|
2017-12-14 20:00:47 +01:00
|
|
|
* @param bits the number of bits, eg: 8
|
|
|
|
* @param mode the mode, eg: 3
|
|
|
|
*/
|
|
|
|
//% help=pins/spi-format weight=3 advanced=true
|
|
|
|
//% blockId=spi_format block="spi format|bits %bits|mode %mode"
|
|
|
|
void spiFormat(int bits, int mode) {
|
|
|
|
auto p = allocSPI();
|
|
|
|
p->format(bits, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-02 05:58:26 +01:00
|
|
|
* Set the MOSI, MISO, SCK pins used by the SPI connection
|
2017-12-14 20:00:47 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
//% help=pins/spi-pins weight=2 advanced=true
|
|
|
|
//% blockId=spi_pins block="spi set pins|MOSI %mosi|MISO %miso|SCK %sck"
|
|
|
|
//% mosi.fieldEditor="gridpicker" mosi.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% mosi.fieldOptions.tooltips="false" mosi.fieldOptions.width="250"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% miso.fieldEditor="gridpicker" miso.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% miso.fieldOptions.tooltips="false" miso.fieldOptions.width="250"
|
2017-12-14 20:00:47 +01:00
|
|
|
//% sck.fieldEditor="gridpicker" sck.fieldOptions.columns=4
|
2019-12-02 05:58:26 +01:00
|
|
|
//% sck.fieldOptions.tooltips="false" sck.fieldOptions.width="250"
|
2017-12-14 20:00:47 +01:00
|
|
|
void spiPins(DigitalPin mosi, DigitalPin miso, DigitalPin sck) {
|
|
|
|
if (NULL != spi) {
|
|
|
|
delete spi;
|
|
|
|
spi = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
spi = new SPI(getPin((int)mosi)->name, getPin((int)miso)->name, getPin((int)sck)->name);
|
|
|
|
}
|
2016-04-02 06:26:06 +02:00
|
|
|
}
|