pxt-calliope/docs/reference/radio/on-data-received.md

24 lines
466 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# On Data Received
Registers code to run when a packet is received over ``radio``.
### Parameters
* body - is an action
### Example
```blocks
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X));
})
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023);
})
```
### See also
2016-04-18 17:33:09 +02:00
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [set group](/reference/radio/set-group)
2016-03-26 00:47:20 +01:00