doc fixes
This commit is contained in:
parent
ffd4d96539
commit
0e0275e496
@ -5,4 +5,8 @@ for (let i = 0;i<5;++i) {}
|
||||
if (true){}
|
||||
let x = 0;
|
||||
Math.random(5);
|
||||
```
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
[logic](/blocks/logic), [loops](/blocks/loops), [math](/blocks/math), [variables](/blocks/variables)
|
@ -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)
|
@ -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).
|
||||
|
@ -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)
|
@ -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)
|
||||
|
38
docs/reference/devices/on-notified.md
Normal file
38
docs/reference/devices/on-notified.md
Normal file
@ -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
|
||||
```
|
@ -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)
|
||||
|
30
docs/reference/game/set-score.md
Normal file
30
docs/reference/game/set-score.md
Normal file
@ -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)
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
31
docs/reference/radio/set-transmit-serial-number.md
Normal file
31
docs/reference/radio/set-transmit-serial-number.md
Normal file
@ -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
|
||||
```
|
16
docs/reference/types/boolean.md
Normal file
16
docs/reference/types/boolean.md
Normal file
@ -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)
|
@ -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!
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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));
|
||||
|
6
libs/microbit/shims.d.ts
vendored
6
libs/microbit/shims.d.ts
vendored
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user