diff --git a/docs/blocks.md b/docs/blocks.md index 491483e0..73ac91c4 100644 --- a/docs/blocks.md +++ b/docs/blocks.md @@ -5,4 +5,8 @@ for (let i = 0;i<5;++i) {} if (true){} let x = 0; Math.random(5); -``` \ No newline at end of file +``` + +## See Also + +[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables) \ No newline at end of file diff --git a/docs/javascript.md b/docs/javascript.md index 5ce2da1a..25c0ff5c 100644 --- a/docs/javascript.md +++ b/docs/javascript.md @@ -34,3 +34,8 @@ Visit the cards below to starting programming JavaScript and TypeScript with the ] ``` + +### See Also + +[calling](/js/call), [sequencing](/js/sequence), [variables](/js/variables), [operators](/js/operators), [statements](/js/statements), [functions](/js/functions), +[types](/js/types), [classes](/js/classes), [FAQ](/js/faq) \ No newline at end of file diff --git a/docs/open-source.md b/docs/open-source.md index 3398a9cc..e5872f3b 100644 --- a/docs/open-source.md +++ b/docs/open-source.md @@ -2,8 +2,13 @@ The editor is open source on GitHub under the MIT license. Contributions are welcome, please check our GitHub repos. -### Repos +### Source Code * [microsoft/pxt-microbit](https://github.com/Microsoft/pxt-microbit), PXT target for BBC micro:bit, also includes the documentation. * [microbit/pxt](https://github.com/Microsoft/pxt), programming experience toolkit (PXT) * [microsoft/pxt-microbit-core](https://github.com/Microsoft/pxt-microbit-core), Yotta module used to build the BBC micro:bit runtime + +## C++ Runtime + +The [C++ micro:bit runtime](http://lancaster-university.github.io/microbit-docs/), created at [Lancaster University](http://www.lancaster.ac.uk/), provides access to the hardware functions of the micro:bit, +as well as a set of helper functions (such as displaying a number/image/string on the LED screen). diff --git a/docs/projects.md b/docs/projects.md index 31c427eb..ce69cb9e 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -47,5 +47,6 @@ Here are some cool projects that you can build with your micro:bit! }] ``` +### See Also - +[Flashing Heart](/projects/flashing-heart), [Smiley Buttons](/projects/smiley-buttons), [Love Meter](/projects/love-meter), [Rock Paper Scissors](/projects/rock-paper-scissors), [Compass](/projects/compass), [Hack your headphones](/projects/hack-your-headphones), [Banana keyboard](/projects/banana-keyboard), [Telegraph](/projects/telegraph), [Radio](/projects/radio), [Watch](/projects/the-watch) \ No newline at end of file diff --git a/docs/reference.md b/docs/reference.md index c288d421..9148d729 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -30,10 +30,11 @@ bluetooth.onBluetoothConnected(() => {}); ``` ```package +microbit-radio microbit-devices microbit-bluetooth ``` ### See Also -[basic](/reference/basic), [input](/reference/input), [music](/reference/music), [led](/reference/led), [Math](/reference/Math), [String](/reference/String), [game](/reference/game), [images](/reference/images), [pins](/reference/pins), [serial](/reference/serial), [control](/reference/control), [radio](/reference/radio), [devices](/reference/devices), [bluetooth](/reference/bluetooth) +[basic](/reference/basic), [input](/reference/input), [music](/reference/music), [led](/reference/led), [Math (blocks)](/blocks/math), [String](/reference/string), [game](/reference/game), [images](/reference/images), [pins](/reference/pins), [serial](/reference/serial), [control](/reference/control), [radio](/reference/radio), [devices](/reference/devices), [bluetooth](/reference/bluetooth) diff --git a/docs/reference/devices/on-notified.md b/docs/reference/devices/on-notified.md new file mode 100644 index 00000000..9c30e153 --- /dev/null +++ b/docs/reference/devices/on-notified.md @@ -0,0 +1,38 @@ +# On Signal Strength Changed + +Register code to run when the signal strength of the paired device changes. + +### ~hint + +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). +The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. + +### ~ + + +```sig +devices.onNotified(MesDeviceInfo.IncomingCall, () => {}) +``` + +### Parameters + +* ``body``: code to run when the signal strength changes. + +### Examples + +Display the signal strength on screen: + +```blocks +devices.onNotified(MesDeviceInfo.IncomingCall, () => { + basic.showString("RING RING") +}) +``` + +### See Also + +[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength) + +```package +microbit-devices +``` \ No newline at end of file diff --git a/docs/reference/game.md b/docs/reference/game.md index 67b51af2..89f1f7ae 100644 --- a/docs/reference/game.md +++ b/docs/reference/game.md @@ -12,4 +12,4 @@ game.setScore(0); ### See Also -[addScore](/reference/game/add-score), [score](/reference/game/score), [startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over), [setScore](/reference/game/set-score) +[addScore](/reference/game/change-score-by), [score](/reference/game/score), [startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over), [setScore](/reference/game/set-score) diff --git a/docs/reference/game/set-score.md b/docs/reference/game/set-score.md new file mode 100644 index 00000000..fda88506 --- /dev/null +++ b/docs/reference/game/set-score.md @@ -0,0 +1,30 @@ +# Set Score + +Sets the current score. + +```sig +game.setScore(1) +``` +### Parameters + +* a [number](/reference/types/number) that represents the new score. + +### Examples + +This program is a simple game. +Press button ``A`` as much as possible to increase the score. +Press ``B`` to display the score and reset the score. + +```blocks +input.onButtonPressed(Button.B, () => { + basic.showNumber(game.score()) + game.setScore(0) +}) +input.onButtonPressed(Button.A, () => { + game.addScore(1) +}) +``` + +### See Also + +[score](/reference/game/score), [start countdown](/reference/game/start-countdown) diff --git a/docs/reference/input.md b/docs/reference/input.md index 2a0b8e50..9b0c48ff 100644 --- a/docs/reference/input.md +++ b/docs/reference/input.md @@ -42,4 +42,4 @@ input.onShake(() => { ### See Also -[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference//input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate](/reference/input/calibrate), [onLogoDown](/reference/input/on-logo-down), [onLogoUp](/reference/input/on-logo-up), [onScreenDown](/reference/input/on-screen-down), [onScreenUp](/reference/input/on-screen-up), [onShake](/reference/input/on-shake) +[onButtonPressed](/reference/input/on-button-pressed), [onGesture](/reference/input/on-gesture), [onPinPressed](/reference/input/on-pin-pressed), [buttonIsPressed](/reference/input/button-is-pressed), [compassHeading](/reference/input/compass-heading), [pinIsPressed](/reference/input/pin-is-pressed), [temperature](/reference/input/temperature), [acceleration](/reference/input/acceleration), [lightLevel](/reference/input/light-level), [rotation](/reference/input/rotation), [magneticForce](/reference/input/magnetic-force), [runningTime](/reference/input/running-time), [setAccelerometerRange](/reference/input/set-accelerometer-range), [calibrate](/reference/input/calibrate), [onLogoDown](/reference/input/on-logo-down), [onLogoUp](/reference/input/on-logo-up), [onScreenDown](/reference/input/on-screen-down), [onScreenUp](/reference/input/on-screen-up), [onShake](/reference/input/on-shake) diff --git a/docs/reference/led.md b/docs/reference/led.md index 2371a71c..179f5db6 100644 --- a/docs/reference/led.md +++ b/docs/reference/led.md @@ -21,4 +21,4 @@ led.setDisplayMode(DisplayMode.BackAndWhite); ### See Also -[plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [brightness](/reference/led/brightness), [setBrightness](/reference/led/set-brightness), [stopAnimation](/reference/led/stop-animation), [plotBarGraph](/reference//led/plot-bar-graph), [fadeIn](/reference/led/fade-in), [fadeOut](/reference/led/fade-out), [plotAll](/reference/led/plot-all), [screenshot](/reference/led/screenshot), [toggle](/reference/led/toggle), [toggleAll](/reference/led/toggle-all), [setDisplayMode](/reference//led/set-display-mode) +[plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [brightness](/reference/led/brightness), [setBrightness](/reference/led/set-brightness), [stopAnimation](/reference/led/stop-animation), [plotBarGraph](/reference/led/plot-bar-graph), [fadeIn](/reference/led/fade-in), [fadeOut](/reference/led/fade-out), [plotAll](/reference/led/plot-all), [screenshot](/reference/led/screenshot), [toggle](/reference/led/toggle), [toggleAll](/reference/led/toggle-all), [setDisplayMode](/reference/led/set-display-mode) diff --git a/docs/reference/pins.md b/docs/reference/pins.md index b1ee7ce4..0c824616 100644 --- a/docs/reference/pins.md +++ b/docs/reference/pins.md @@ -24,4 +24,4 @@ pins.analogSetPitchPin(AnalogPin.P0); ### See Also -[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/serial-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch) +[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/servo-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch) diff --git a/docs/reference/radio/set-transmit-serial-number.md b/docs/reference/radio/set-transmit-serial-number.md new file mode 100644 index 00000000..12c9af96 --- /dev/null +++ b/docs/reference/radio/set-transmit-serial-number.md @@ -0,0 +1,31 @@ +# Set Transmit Serial Number + +Make the ``radio`` packet embed the board serial number with each packet of data. + +```sig +radio.setTransmitSerialNumber(true); +``` + +### Parameters + +* ``transmit`` is a [boolean](/reference/types/boolean) that represents whether the serial number needs to be transmitted. + +### Simulator + +This function only works on the micro:bit, not in browsers. + +### Example + +This program makes the ``radio`` send the serial number in each packet. + +```blocks +radio.setTransmitSerialNumber(true); +``` + +### See also + +[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received) + +```package +microbit-radio +``` \ No newline at end of file diff --git a/docs/reference/types/boolean.md b/docs/reference/types/boolean.md new file mode 100644 index 00000000..3f40a964 --- /dev/null +++ b/docs/reference/types/boolean.md @@ -0,0 +1,16 @@ +# Boolean + +true or false. + +A Boolean has one of two possible values: `true`; `false`. Boolean (logical) operators (*and*, *or*, *not*) take Boolean inputs and yields a Boolean value. Comparison operators on other types ([numbers](/reference/types/number), [strings](/reference/types/string) yields a Boolean value. + +The following blocks represent the true and false Boolean values, which can be plugged in anywhere a Boolean value is expected: + +```blocks +true; +false; +``` + +### See Also + +[boolean (blocks)](/blocks/boolean.md) diff --git a/docs/windows10.md b/docs/windows10.md deleted file mode 100644 index 3f79bbc3..00000000 --- a/docs/windows10.md +++ /dev/null @@ -1,12 +0,0 @@ -# Windows 10 App - -## Features - -The Windows 10 App provides all the existing features of [codethemicrobit](https://codethemicrobit.com) plus the following ones: - -* **auto-upload**: the compiled .hex file is automatically deployed to all connected BBC micro:bits -* **serial piping**: all serial data sent by connected BBC micro:bit is automatically imported and analyzed in the editor. - -## Installing the app - -Coming to the store soon! \ No newline at end of file diff --git a/libs/microbit/input.cpp b/libs/microbit/input.cpp index 94d63ea2..8380c25d 100644 --- a/libs/microbit/input.cpp +++ b/libs/microbit/input.cpp @@ -253,7 +253,7 @@ namespace input { * The pitch of the device, rotation along the ``x-axis``, in degrees. * @param kind TODO */ - //% help=/input/rotation weight=52 + //% help=input/rotation weight=52 //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" int rotation(Rotation kind) { switch (kind) { diff --git a/libs/microbit/led.cpp b/libs/microbit/led.cpp index b5bd7e30..dfb452fc 100644 --- a/libs/microbit/led.cpp +++ b/libs/microbit/led.cpp @@ -77,7 +77,7 @@ namespace led { * Sets the display mode between black and white and greyscale for rendering LEDs. * @param mode TODO */ - //% weight=1 help=/led/set-display-mode + //% weight=1 help=led/set-display-mode void setDisplayMode(DisplayMode_ mode) { uBit.display.setDisplayMode((DisplayMode)mode); } diff --git a/libs/microbit/led.ts b/libs/microbit/led.ts index ed2a7567..d4641b01 100644 --- a/libs/microbit/led.ts +++ b/libs/microbit/led.ts @@ -15,7 +15,7 @@ * @param value current value to plot * @param high maximum value. If 0, maximum value adjusted automatically, eg: 0 */ - //% help=/led/plot-bar-graph weight=20 + //% help=led/plot-bar-graph weight=20 //% blockId=device_plot_bar_graph block="plot bar graph of %value |up to %high" icon="\uf080" blockExternalInputs=true export function plotBarGraph(value: number, high: number): void { let now = input.runningTime(); diff --git a/libs/microbit/pins.cpp b/libs/microbit/pins.cpp index a9614e28..6df58fc0 100644 --- a/libs/microbit/pins.cpp +++ b/libs/microbit/pins.cpp @@ -182,7 +182,7 @@ namespace pins { * @param name pin name * @param micros pulse duration in micro seconds, eg:1500 */ - //% help=pins/serial-set-pulse weight=19 + //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" void servoSetPulse(AnalogPin name, int micros) { PINOP(setServoPulseUs(micros)); diff --git a/libs/microbit/shims.d.ts b/libs/microbit/shims.d.ts index bc2e29a6..cf6f463f 100644 --- a/libs/microbit/shims.d.ts +++ b/libs/microbit/shims.d.ts @@ -283,7 +283,7 @@ declare namespace input { * The pitch of the device, rotation along the ``x-axis``, in degrees. * @param kind TODO */ - //% help=/input/rotation weight=52 + //% help=input/rotation weight=52 //% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197" shim=input::rotation function rotation(kind: Rotation): number; @@ -439,7 +439,7 @@ declare namespace led { * Sets the display mode between black and white and greyscale for rendering LEDs. * @param mode TODO */ - //% weight=1 help=/led/set-display-mode shim=led::setDisplayMode + //% weight=1 help=led/set-display-mode shim=led::setDisplayMode function setDisplayMode(mode: DisplayMode): void; /** @@ -527,7 +527,7 @@ declare namespace pins { * @param name pin name * @param micros pulse duration in micro seconds, eg:1500 */ - //% help=pins/serial-set-pulse weight=19 + //% help=pins/servo-set-pulse weight=19 //% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros" shim=pins::servoSetPulse function servoSetPulse(name: AnalogPin, micros: number): void;