First Program: Author a Button
Students open the robot's receiver in MakeCode and give a button a new behavior by editing the dispatch skeleton — their first program.
Opening Concept
Run Sheet
- 0:00–0:08 Recap & hook
Last time you drove it. Today you change what it does.
- Show a button doing something new — a sound, an image, the gripper.
- 0:08–0:23 Open & flash the baseline
Open the receiver share link, connect over WebUSB, and flash the unchanged project.
- Confirm driving still works after flashing.
Watch for: Charge-only USB cables power the board but won’t flash it. Use a data cable.
If they're stuck: Use Chrome or Edge, click Connect device, and pick the micro:bit.
- 0:23–0:38 Read the skeleton
Walk the dispatch structure together.
- Each button sets a light and does an action (D and E are worked examples — open/close gripper).
- Driving runs on every message, outside the if/else — so editing a button can’t break it.
- C and F are empty slots waiting for the student’s first code.
- 0:38–1:03 Author a button Modify
Copy the worked pattern into C or F: make the button do something visible, and set its light.
- Options: play a sound, flash an image, close the gripper, trigger a dance move.
- Flash and test on the robot.
Watch for: Edited but didn’t flash (’nothing changed’) — confirm they clicked Download and the robot re-flashed.
- 1:03–1:15 Iterate & extend
Tweak it; fill the second empty slot if time allows.
- Notebook: what did your button do versus what you expected?
If they finish early: Chain two actions in one button (light + sound + move), or design a ‘signature’ light pattern.
- 1:15–1:25 Share-out
Three or four students show their button.
- Celebrate the range — every student made the robot do something different.
- 1:25–1:30 Wrap-up & pack
Save the share link, power down, store devices.
- Remind students their program lives at the share link — they’ll build on it next time.
Materials
Engineering Connection
Build (modify)
Troubleshooting
- Edited the program but nothing changed
- They didn’t flash. Click Download and confirm the robot re-flashed; check the right device is selected in WebUSB.
- Pairing or driving broke after editing
- They likely opened the transmitter by mistake. Re-open the receiver share link — students only edit the receiver.
- The new action runs all the time, or driving stopped
- Code went in the wrong place. Keep the action inside the C/F button branch; leave the driving line where it is.
- Can't tell whether the button fired
- Set a distinct light color in the branch first — the headlight is a built-in ‘did it run?’ check.
- WebUSB won't connect
- Use Chrome or Edge, a data cable, then Connect device and pick the micro:bit.