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

466 B

On Data Received

Registers code to run when a packet is received over radio.

Parameters

  • body - is an action

Example

basic.forever(() => {
    radio.sendNumber(input.acceleration(Dimension.X));
})
radio.onDataReceived(() => {
    led.plotBarGraph(radio.receiveNumber(), 1023);
})

See also

receive number, send number, set group