Programming a micro:bit in Python – Year 8 Computing lesson
Pupils learn to write a micro:bit program in Python that uses a while True loop to keep checking its buttons and control what the display shows.
Lesson 2 of 6 in unit 8.6 Physical Computing, taught in Year 8, Summer 2. It answers one big question: How do we program the tiny computer inside a device?
By the end, pupils can write a micro:bit program in Python that uses a while True loop to keep checking its buttons and control what the display shows.
- The Build (the main task)
- Write a micro:bit program that, inside a while True loop, shows a happy face when button A is pressed and scrolls WATER ME when button B is pressed.
- Support version
- Parsons problem: the program's lines are jumbled, with one extra line that has no while True loop around the button checks.
- Challenge
- Count the presses of button A in a variable and show the count when B is pressed, like a simple step counter.
- Real-world link
- Plant Buddy starts as a micro:bit: today it learns to show a face and a message when its buttons are pressed.
- Key words
- Embedded system, Microcontroller and Control, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “The micro:bit keeps checking the buttons by itself, so the if lines do not need a loop”; “An embedded system is a full computer, like a laptop, that can run any app”.
- National Curriculum
- NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions); NC5 (hardware and software components and how they communicate with each other and other systems).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
Pupils need computers for the main task.
Also sold in the Physical Computing unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for KS3 Computing
See allPupils learn to name the sensors and actuators in a smart device, say what each one detects or does, and show how they link through a processor.
Free sample lessonPupils learn to read a sensor inside a loop and use if/elif/else with a threshold so a micro:bit responds in real time.
Pupils learn to model a control system as a flowchart with a feedback loop, and choose which real-world details to keep or leave out.
Written for the specifications named. Not endorsed by or affiliated with any exam board.