Merge branch 'master' of https://github.com/Microsoft/pxt-microbit
This commit is contained in:
commit
4cbabcd112
@ -1,13 +1,19 @@
|
|||||||
# On Data Received
|
# On Data Received
|
||||||
|
|
||||||
Registers code to run when a packet is received over ``radio``.
|
Run part of a program when the micro:bit receives a
|
||||||
|
[number](/reference/types/number) or [string](/reference/types/string) over ``radio``.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* body - is an action
|
* **body** is the part of the program to run when the micro:bit receives information over ``radio``.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
This program never stops. It keeps sending numbers that says how
|
||||||
|
fast the micro:bit is slowing down or speeding up. It also receives
|
||||||
|
numbers that say how fast nearby micro:bits are going. It
|
||||||
|
shows these numbers as a [bar graph](/reference/led/plot-bar-graph).
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
radio.sendNumber(input.acceleration(Dimension.X));
|
radio.sendNumber(input.acceleration(Dimension.X));
|
||||||
@ -19,5 +25,6 @@ radio.onDataReceived(() => {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
|
[receive number](/reference/radio/receive-number),
|
||||||
|
[send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
|
||||||
|
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.2.155"
|
"pxt-core": "0.2.154"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user