Students program a micro:bit to act on words the computer sends over USB, reply to each one, and handle words it doesn't know.
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
Predict and Run 6 min · Send commands 8 min (typical) · Investigate 8 min · Modify 10 min · Make 10 min · Test the lamp 3 min (typical)
The idea: the computer sends a line of text; on serial data received runs once the whole line has arrived (it ends with a new line), and read line gives its text. The micro:bit's own program decides what each word means, so both sides must agree on every word, capital letters included. A reply (ok, or ? for an unknown word) tells the computer what happened.
Hardware: the simulator cannot receive lines from the computer, so the board steps need a micro:bit, a data USB cable and Chrome or Edge. They are marked typical: without micro:bits, students do Predict, Investigate, Modify and Make in the editor (code checks still tick) and talk through what would happen.
Only one page can use the cable at a time: if MakeCode is connected to the micro:bit, disconnect it there first.
The micro:bit acts only on the exact words it checks for. When a word does nothing, ask them to compare it letter by letter with the program.
| What you will see | A question to ask | The fix |
|---|---|---|
| Nothing happens when a button is pressed. | Is the board connected (the button says micro:bit connected)? Is MakeCode connected to the micro:bit in another tab? | Disconnect MakeCode, then Connect a micro:bit on the board. |
| Some words work and others don't. | Does the word you sent match the word in the if exactly? | Match spelling and capitals, or add a branch. |
| The micro:bit never reacts to anything. | Which delimiter does on serial data received wait for? | Use new line. |
One possible solution for each task. Other correct programs are fine.

serial.onDataReceived(serial.delimiters(Delimiters.NewLine), function () {
command = serial.readLine()
if (command == "happy") {
basic.showIcon(IconNames.Happy)
} else if (command == "sad") {
basic.showIcon(IconNames.Sad)
} else if (command == "heart") {
basic.showIcon(IconNames.Heart)
}
})
let command = ""

serial.onDataReceived(serial.delimiters(Delimiters.NewLine), function () {
command = serial.readLine()
if (command == "happy") {
basic.showIcon(IconNames.Happy)
serial.writeLine("ok")
} else if (command == "sad") {
basic.showIcon(IconNames.Sad)
serial.writeLine("ok")
} else {
serial.writeLine("?")
}
})
let command = ""

serial.onDataReceived(serial.delimiters(Delimiters.NewLine), function () {
command = serial.readLine()
if (command == "on") {
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
`)
serial.writeLine("ok")
} else if (command == "off") {
basic.clearScreen()
serial.writeLine("ok")
} else if (command == "count") {
basic.showNumber(count)
serial.writeValue("count", count)
} else {
serial.writeLine("?")
}
count += 1
})
let count = 0
let command = ""
Stretch: Add a command that takes a number, such as bright 50: check the line starts with bright, and use the rest as the brightness.
Support: Give the reply branch for happy; students copy the pattern for sad and add the else.
The computer sends Stop but the micro:bit's program checks for stop. What happens, and how would you fix it?
Nothing matches, so nothing happens (or the else runs). Make both sides use exactly the same word.
Next: a radio bridge, so commands reach a micro:bit across the room. Real world: 3D printers and CNC machines take G-code, one command per line.