2.15. Radio Communications#

The onboard radio transceiver can be used to send strings between different micro:bits.

2.15.1. Channels#

The micro:bit radio protocol supports 84 channels (0 to 83) that it can communicate on. Note that:

  • Communication on each channel is independent. You have to be on a particular channel to send and receive messages to it and you won’t see messages from other channels.

  • The channel is public. Everyone will receive all the messages broadcast on the channel if they are within range.

To configure the channel use

import radio

radio.config(channel=7)

The default radio channel is 7.

2.15.2. Sending Data#

To send a message use

import radio

radio.send(message)

where message is a string.

2.15.3. Receiving Data#

To receive a message use

import radio

radio.receive()

which returns a string containing the received messages since last checking.