Broadcast messages are of a certain configurable length (up to 251 bytes).
Messages received are read from a queue of configurable size (the larger the queue the more RAM is used). If the queue is full, new messages are ignored.
Messages are broadcast and received on a preselected channel (numbered 0-100).
Broadcasts are at a certain level of power - more power means more range.
Messages are filtered by address (like a house number) and group (like a named recipient at the specified address).
The rate of throughput can be one of three pre-determined settings.
Send and receieve bytes to work with arbitrary data.
As a convenience for children, it’s easy to send and receive messages as strings.
The default configuration is both sensible and compatible with other platforms that target the BBC micro:bit.
N.B. For the script below to access the radio module you will need to use the http://python.microbit.org beta version of the Python editor.
Light switch micro:bit - hand held controller script:
from microbit import *
import radio
radio.on()
while True:
if button_a.is_pressed():
display.scroll("ON")
radio.send('code_on') # The code you send can be anything you like so long as you use the same code in the receiving micro:bit's script.
sleep(50)
if button_b.is_pressed():
display.scroll("OFF")
radio.send('code_off') # The code you send can be anything you like so long as you use the same code in the receiving micro:bit's script.
sleep(50)
Light controller micro:bit script:
from microbit import *
import radio
radio.on()
while True:
msgin = radio.receive()
if msgin == 'code_on':
# ------turn light on
pin1.write_digital(1)
display.scroll("ON")
sleep(50)
if msgin == 'code_off':
# ------turn light off
pin1.write_digital(0)
display.scroll("OFF")
sleep(50)
See the diagrams below for wiring the micro:bits and writing the BlockCode scripts.