A radio group is a channel, not a lock. Every micro:bit in the group hears every message, so anything sent in plain text is public to the group.
A school bus radio, a walkie-talkie, a baby monitor: if your radio is on the same channel, you hear it. That is how radio works, and it is why secret messages need more than a channel number.
Radio is how micro:bits talk without a cable. Each one is set to a radio group (a number from 0 to 255). A micro:bit sends to every other micro:bit in its group and to nobody outside it.
This course is about a question that follows: if a message goes out to everyone in the group, how can any of it be private? You will build the answers: secret codes, a way to share a key, a way to spot a changed message, and a way to prove who sent it.
Predict: Read the code and say what it will do before you run anything. A wrong guess is fine: it shows you what to look for.
Run: Run it and compare the result with your prediction.
Investigate: Trace how each line of code connects to what you see.
Modify: Change the code on purpose and check the result.
Make: Build something new using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the code and say what it will do before you run anything. A wrong guess is fine: it shows you what to look for.
Predict
Show as code
radio.ts
radio.setGroup(5)
input.onButtonPressed(Button.A, function () {
radio.sendString("MEET AT 3")
})
radio.onReceivedString(function (receivedString) {
basic.showString(receivedString)
})
RunRun it and compare the result with your prediction.
Run
The simulator runs the program on two micro:bits. Press A on one and watch the other.
Show as code
radio.ts
radio.setGroup(5)
input.onButtonPressed(Button.A, function () {
radio.sendString("MEET AT 3")
})
radio.onReceivedString(function (receivedString) {
basic.showString(receivedString)
})
Try it yourselfYour edits are saved in this browser.
It takes a few seconds to load. Your work in this step is kept.
InvestigateTrace how each line of code connects to what you see.
Investigate
Show as code
radio.ts
radio.setGroup(5)
input.onButtonPressed(Button.A, function () {
radio.sendString("MEET AT 3")
})
radio.onReceivedString(function (receivedString) {
basic.showString(receivedString)
})
Match each block with what it does.
radio set group 5
radio send string
on radio received string
Who hears a message sent from a micro:bit in group 5?
Another micro:bit in group 5, across the room
A micro:bit in group 6
A micro:bit in group 5 in the next classroom
The micro:bit that sent it
ModifyChange the code on purpose and check the result.
Modify
Make B send a second message of your own. Every micro:bit in the group would read it.
Try it yourselfYour edits are saved in this browser.
It takes a few seconds to load. Your work in this step is kept.
Need a hint?
Copy the A block, change it to Button B and change the text.
A sends one message and B sends a different one.
This ticks by itself when your blocks do what is asked.
MakeBuild something new using what you have learned. Expect a few tries; that is normal.
Make
Make a doorbell. Pressing A on one micro:bit sends RING; the other shows an icon and plays a tone. You will meet this doorbell again: by the end of the course it will be a lock that is hard to fool.
Try it yourselfYour edits are saved in this browser.
It takes a few seconds to load. Your work in this step is kept.
Need a hint?
Pressing A sends the word RING.
Another hint
On radio received string: if the text is RING, show an icon and play a tone.
A doorbell: A sends RING; a micro:bit that receives RING shows an icon and plays a tone.
This ticks by itself when your blocks do what is asked.
For teachers
Students learn that a radio group is a shared channel, so plain-text radio messages are public to everyone in the group. About 40 minutes.
I can explain why a group number does not make a message private.
I can send and receive a text message by radio.
Before class
The idea: radio goes to everyone. A radio group is a channel number; it decides who is listening, not who is allowed to listen. Anything sent in plain text can be read by any micro:bit set to that group.
Why start here: the whole course answers one question: if everyone in the group hears everything, how do we keep a message private, know it was not changed, and know who sent it? Students should leave this lesson feeling that question is real.
Hardware: the course works in the simulator throughout. Real micro:bits make it better: give every pair its own group and write the numbers on the board.
Running the lesson
Predict: most say 3 or 4. Ask: does the sender hear itself? Is group 6 listening?
Investigate: Mia's 'secret' group is the key misconception. Ask what a stranger would have to do to hear it.
The hard part (on purpose)
A group number is a channel, not a lock. Ask who else can hear the message before they assume it is private.
When students get stuck
Nothing arrives. Ask: Are both micro:bits in the same group? Is the other one running the program? Fix: Use the same radio set group number on both.
Messages from other pairs appear. Ask: Which group number are you using? Fix: Pick your own number and download again.
Stretch and support
Stretch: Add a third micro:bit in the same group and see that both hear A's message.
Support: Give the doorbell with the receiving part complete.
Where it leads
Next: hide the message from anyone who is listening, starting with a simple scrambling method.
What each step is for
Investigate: A group number picks a channel. It does not hide anything: every micro:bit set to that group hears every message, in plain text.
Modify: Adding a message is easy; so is anyone's reading it. Nothing in the program hides the text.
Now you can
Say who hears a message sent by radio.
Explain why a group number does not make a message private.