pxt-calliope/docs/reference/radio/receive-number.md

475 B

Receive Number

Reads the next radio packet if any and returns the first number.

Return value

  • the first number number of the packet if any. 0 otherwise.

Examples

Read the number broadcasted by other micro:bits.

radio.onDataReceived(() => {
    led.plotBarGraph(radio.receiveNumber(), 1023);
})

See also

receive number, on data received