One micro:bit sends numbers by radio; the robot turns each number into a move.
Rescue robots go into collapsed buildings and bomb-disposal robots up to suspicious bags, while the person driving stays far away and safe. Each button press is a short message over radio.
In micro:bit Foundations you sent radio messages between micro:bits. Now the messages drive a robot. The remote sends a number for each button; the robot listens and turns each number into a move. Both micro:bits must be in the same radio group.
When a program uses radio, the simulator shows two micro:bits and two robots, running the same program. Each micro:bit is a remote for the other robot.
Make your prediction first. Help opens once you've locked it in.

input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
input.onButtonPressed(Button.B, function () {
radio.sendNumber(2)
})
input.onButtonPressed(Button.AB, function () {
radio.sendNumber(0)
})
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
robot.motorTank(50, 50)
} else if (receivedNumber == 2) {
robot.motorTank(50, -50, 400)
robot.motorStop()
} else {
robot.motorStop()
}
})
robot.elecfreaksCuteBot.start()
radio.setGroup(1)
Press A, B and A+B on the first micro:bit, and watch the second robot. Then try the buttons on the second micro:bit.

input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
input.onButtonPressed(Button.B, function () {
radio.sendNumber(2)
})
input.onButtonPressed(Button.AB, function () {
radio.sendNumber(0)
})
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
robot.motorTank(50, 50)
} else if (receivedNumber == 2) {
robot.motorTank(50, -50, 400)
robot.motorStop()
} else {
robot.motorStop()
}
})
robot.elecfreaksCuteBot.start()
radio.setGroup(1)

input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
input.onButtonPressed(Button.B, function () {
radio.sendNumber(2)
})
input.onButtonPressed(Button.AB, function () {
radio.sendNumber(0)
})
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
robot.motorTank(50, 50)
} else if (receivedNumber == 2) {
robot.motorTank(50, -50, 400)
robot.motorStop()
} else {
robot.motorStop()
}
})
robot.elecfreaksCuteBot.start()
radio.setGroup(1)
Match each button with its message and the robot's move.
Ben's remote:

input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
radio.setGroup(1)
Ben's robot:

radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
robot.motorTank(50, 50)
}
})
robot.elecfreaksCuteBot.start()
radio.setGroup(2)
Match each button with the number it sends and what the robot does.
A driver needs to know what the robot heard. Make the robot's micro:bit show each number it receives.
show number is in Basic. Put it at the top of on radio received, and drag receivedNumber into it.
Add a fourth command: shaking the remote sends 3, and the robot backs up for one second.
on shake sends 3. In on radio received, add an else if: receivedNumber = 3.
Inside it: robot motor tank −50 −50 for 1000 ms, then robot motor stop.
The robot's micro:bit shows each number it receives.
This ticks by itself when your blocks do what is asked.
Add a reverse command: shaking the remote sends 3, and the robot backs up for 1 second.
This ticks by itself when your blocks do what is asked.
Make a remote for a rescue robot that moves in small, careful steps:
Use the first micro:bit to steer the second robot round a box and back.
Four buttons: A, B, A+B and the logo. Each sends a different number.
In on radio received, one branch per number: small left turn, small right turn, forward for 1 second, stop.
A rescue-robot remote: left, right, forward and stop, each a different number.
This ticks by itself when your blocks do what is asked.
With real micro:bits, download the program to the remote and to the micro:bit in the robot. Things to notice:
Students turn a micro:bit into a radio remote control; each button sends a number and the robot turns each number into a move. About 45 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
Students used radio in micro:bit Foundations (Send and receive, Messages with meaning). Here the remote sends a number for each command and the robot decides what each number means, in on radio received. The two sides must agree on the group and on the code (1 = forward, 2 = turn, 0 = stop). A micro:bit never hears its own messages.
When a program uses radio, the simulator runs it on two micro:bits, each with a robot, in one arena. Each is the remote for the other robot. This is a little odd at first; say it up front. With real hardware, the same program can go on both micro:bits.
Untested on real hardware: whether the robot start block shows an error on a micro:bit that is not in a robot. If it does, give the remote a copy without that block. Real classrooms need a different radio group for every pair. MOVE Motor classes can use this lesson unchanged on the remote side, and Kitronik blocks on the robot side.
Both sides must agree on the code and the radio group. Ask which robot they're watching and what number was sent last.
Stretch: Steer by tilting: in forever on the remote, send 1 when tilted left (acceleration x < −300), 2 when tilted right, and 0 when level.
Support: Give the robot side complete; students build the remote buttons to match the code table.
Next: one micro:bit cues several robots to dance in time to music. Real-world links: rescue and bomb-disposal robots, drones, robots on Mars (where each message takes minutes to arrive, so the robot must also decide things for itself).