Students make a micro:bit send sensor readings to the computer over USB as named lines of text, and watch them graphed.
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 8 min · On a real micro:bit 8 min (typical) · Investigate 8 min · Modify 10 min · Make 10 min
The idea: a micro:bit plugged into a computer can send text down the USB cable, one line at a time (this is called serial). serial write value sends a line such as light:128: a name, a colon and a number. Whatever is on the other end (MakeCode's Show data, the board in this lesson, a spreadsheet) turns those lines into a table or a graph.
Without micro:bits: the MakeCode simulator shows the values under Show data, so every required step works in the browser. The board step ("On a real micro:bit") is optional and needs a micro:bit, a data USB cable and Chrome or Edge.
With micro:bits: students download the program, leave the micro:bit plugged in, and click Connect a micro:bit on the board. Only one page can use the cable at a time, so if MakeCode is connected to the micro:bit, disconnect it there first.
The text format links the micro:bit and the board. When nothing shows, ask whether the program is running and the write block is inside forever.
| What you will see | A question to ask | The fix |
|---|---|---|
| Show data never appears. | Is the program running? Is serial write value inside forever? | Restart the simulator; put the send inside forever. |
| Connect a micro:bit lists nothing. | Are you in Chrome or Edge, with a data cable? | Use Chrome or Edge; try another cable (some only charge). |
| Only one reading arrives. | Which block is the send in? | Move it into forever with a pause. |
One possible solution for each task. Other correct programs are fine.

basic.forever(function () {
serial.writeValue("light", input.lightLevel())
serial.writeValue("temperature", input.temperature())
basic.pause(500)
})

basic.forever(function () {
serial.writeValue("light", input.lightLevel())
basic.pause(100)
})

basic.forever(function () {
serial.writeValue("x", input.acceleration(Dimension.X))
serial.writeValue("y", input.acceleration(Dimension.Y))
basic.pause(200)
})
input.onButtonPressed(Button.A, function () {
serial.writeLine("mark")
})
Stretch: Send the sound level too, and find out which is noisier: the classroom or the corridor.
Support: Give the Make program with x done; students add y and the button.
What does the computer receive when the micro:bit runs serial write value light, light level?
A line of text: the name light, a colon and the reading, such as light:128.
Next: the computer sends commands to the micro:bit. Real world: data loggers in science labs, weather stations and fitness trackers.