Lesson at a glance
maze.education/microbit/lessons/name-badge
- Grades
- Grades 3 to 5
- Time
- 45 to 60 minutesThe CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades R to 3, page 20; Grades 4 to 6, page 22).
- Level
- Getting startedA good first or second micro:bit lesson. No coding needed before.
- Board
- Any micro:bit
- Code with
- MakeCode and Purple Mash blocks, with Python as an extension
- CAPS
- Coding and RoboticsAligned: Grade 5, Term 3 · Where it fits
Learning intentions
Learners will learn to:
- Explain that a micro:bit is a small computer that follows instructions in order.
- Use an event, a button press, to start part of a program.
- Test a program in the MakeCode simulator, then download it to a micro:bit if the class has one.
Success criteria
Each learner can say:
- I can say that a micro:bit is a computer, and name one of its inputs and one of its outputs.
- I can make button A show my name and button B show a picture.
- I can test my program on the on-screen micro:bit before I download it.
Competencies
From the Coding and Robotics CAPS places this lesson cites.
- R.6Mimic the operations of a robot
- D.1Outline the concept of technology and purpose of information technology (IT)
- D.7Present a basic understanding of the concept of input processing and output
- D.10Demonstrate a basic proficiency in the application of digital skills
Key words
- program
- A set of instructions that a computer follows.
- algorithm
- The steps to solve a problem, in the right order.
- input
- Information going into a computer, such as a button press.
- output
- What a computer does, such as lighting up its display.
- event
- Something that happens, like a button press, that starts part of a program.
What you need
- One micro:bit per learner or pair, with a USB cable and a battery holder
- A computer with Chrome or Edge for each learner or pair
- Paper and pencils for the plan
From our shop: BBC micro:bit V2 Go, BBC micro:bit V2.21 Next Gen Classroom Pack
Safety
- Keep USB cables tidy on the desk so nobody trips over them or pulls a laptop off the table.
- Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.
- Unplug the battery holder by holding its plug, never by pulling the wires.
The lesson plan
One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.
Introduction
5 to 10 minutesRetrieval practiceWhat is an algorithm? (Clear steps, in the right order, that solve a problem, such as the steps for making a cup of tea.)
Problem statementOn the first day of term, a new teacher, a student teacher or a visitor has to learn thirty names at once. Program a badge that says hello and shows its wearer's name at the press of a button.
- Hold up a micro:bit and ask: is this a computer? Agree that it is. It takes in information (inputs), works with it and does something (outputs). Point out the 25 lights, buttons A and B, and the gold pins along the bottom edge.
- Read the problem statement together. Ask: what should the badge show when nobody presses anything?
Lesson development
35 to 40 minutes- Unplugged first. Play robot teacher: learners give you instructions to write your name on the board, one small step at a time, and you follow them exactly, even when they are wrong. A computer needs clear steps in the right order too.
- Plan on paper first. Pairs draw the badge's IPO table: for each input (switching on, button A, button B), what the micro:bit does and what we see.
- Predict. Show the finished blocks and ask: when the badge is switched on, what will it show first? What happens if you press B before A?
- Build in blocks. Pairs share one computer. The driver opens MakeCode and builds the program from the steps on the Blocks tab; the navigator holds the IPO table and checks that each event matches a row. Swap roles halfway, after step 4, so each learner builds one button.
- Test and debug. Click button A on the on-screen micro:bit first. Did it do what you predicted? Then change the name to your own, choose a different icon for button B, and test again.
- Plug in a micro:bit and download the program. Clip on the battery holder and swap badges with another pair: can they work out what each button does without being told?
Plan on paper: a model answer
In pairs, fill in an IPO table with one row for each input the badge uses.
IPO table
Input Processing Output The micro:bit is switched on Run the blocks in on start, once Hi! scrolls across the display Button A is pressed Run the blocks in on button A pressed The name scrolls across the display Button B is pressed Run the blocks in on button B pressed A picture (an icon) shows Consolidation
5 to 10 minutes- Ask: in our program, what are the inputs and what are the outputs? Point to the rows of the IPO table.
- Two or three learners show their badges and say what they changed.
- Quick check: what would happen if the name went in on start instead of on button A pressed? Back to the problem: would the badge help a visitor learn names, and what would make it better? Learners check themselves against the success criteria.
Build it, step by step
Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.
These are the MakeCode steps. The other routes are on the lesson's web page.
Build it in MakeCode blocks
- Go to makecode.microbit.org, click New Project and call it Name badge.
- From Basic, drag show string into on start and change Hello! to Hi!
- From Input, drag on button A pressed onto the workspace.
- From Basic, drag another show string into on button A pressed and type your name.
- Drag in a second on button A pressed, click the A and change it to B.
- From Basic, drag show icon into the B block and pick a picture.
- Click Download. If the micro:bit is paired, the program goes straight onto it. If not, drag the downloaded .hex file onto the MICROBIT drive.
input.onButtonPressed(Button.A, function () {
basic.showString("Sam")
})
input.onButtonPressed(Button.B, function () {
basic.showIcon(IconNames.Happy)
})
basic.showString("Hi!")To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.
To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.
Purple Mash follows the UK school years, which run about one grade ahead of ours: Year 3 is roughly Grade 2 here, Year 4 roughly Grade 3 and Year 5 roughly Grade 4. 2Simple says its micro:bit lessons can be adapted for other ages, so older learners who are new to the micro:bit can use them too.
These steps are our own. 2Simple's lesson has its own plan, slides and videos, which teachers with a Purple Mash login can use alongside this one.
Our steps in Free Code micro:bit
Block names in Free Code micro:bit are not the same as MakeCode's, so these steps say what each block does. Check the exact names in Purple Mash.
- Log in to Purple Mash and open the lesson from the Computing Scheme of Work, or the micro:bit projects in the Computing area. They use Free Code micro:bit, 2Simple's block coding tool for the micro:bit (2Simple's help pages also call it 2Code micro:bit).
- Open Free Code micro:bit from the Name Badge lesson.
- Find the block that runs when the program starts and add a block that scrolls text. Type Hi!
- Add the block that runs when button A is pressed, with a scrolling text block inside it for your name.
- Add a button B block that shows a picture.
- Test the program on the on-screen micro:bit (2Simple calls it the micro:bit emulator) before you send it to a board.
- Save your work, open the purple menu at the top and choose Download.Hex. Plug in the micro:bit with a USB cable that carries data and drag the .hex file onto the MICROBIT drive. On an iPad, open the file in the micro:bit app and tap Send to micro:bit.
2Simple says the micro:bit projects can also be coded in Python in Pieces, if your school has it.
Extension: text-based coding, beyond the CAPS
The same program in MicroPython, for the micro:bit Python Editor. It suits Grade 7 to 9 learners who are ready for text-based code. The CAPS itself follows a block-based approach (Coding and Robotics CAPS, Grades 7 to 9, page 24).
# Name badge: change Sam to your own name.
from microbit import *
display.scroll("Hi!")
while True:
if button_a.was_pressed():
display.scroll("Sam")
if button_b.was_pressed():
display.show(Image.HAPPY)
sleep(100)In Python the program checks the buttons over and over inside while True, instead of waiting for an event.
Open the Python editor, replace the code that is there with this program (or open the downloaded file), then click Send to micro:bit. MakeCode also has a Python view, which is written a little differently.
Extension or homework
Challenges for learners who finish early, or to take further in a club or as homework.
- Challenge 1
Make the badge say hello in another language the class speaks, such as Sawubona, Molo or Dumela, before your name.
- Challenge 2
Add on button A+B pressed to show your age or your favourite number with show number.
- Challenge 3
Make a badge that keeps going by itself: put your name and a picture in forever so it loops all day.
Support and extension
Support
For learners who need more help
- Give learners a printed picture of the finished blocks, so they can match shapes and colours.
- Pair a confident learner with one who is new to computers, and let the new learner be the driver first, with the confident one navigating.
Extension
For learners who are ready for more
- Use show leds from Basic to draw a picture of your own for button B.
- Add on shake from Input so that shaking the badge shows a heart.
Informal assessment
Ask these as learners work. Informal assessment happens every day and is not recorded.
- What is a program?
- Which block runs as soon as the micro:bit gets power?
- Name one input and one output on the micro:bit.
Why is it a good idea to test on the screen before downloading?
Observation checklist
Watch pairs as they plan, build and test. Write each pair's initials under the level you see.
| Watch for | Beginning | Developing | Accomplished | Exemplary |
|---|---|---|---|---|
| Names an input and an output on the micro:bit. | ||||
| Matches each event in the program to a row of the IPO table. | ||||
| Takes a turn as driver and as navigator. | ||||
| Tests on the on-screen micro:bit before downloading. |
- Beginning:
- not yet, even with help
- Developing:
- with help
- Accomplished:
- on their own
- Exemplary:
- on their own, and explains it or takes it further
The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades R to 3, page 127; Grades 4 to 6, page 176). The short descriptions are ours.
In Grade 3, all assessment is school-based, through observation, oral, practical and written tasks (Coding and Robotics CAPS, Grades R to 3, page 121). This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170).
Common mistakes and fixes
- Nothing happens when I press A.Check that the block says A, and that the program was downloaded again after the last change. Press the reset button on the back to start it again.
- The MICROBIT drive does not appear.Try another USB cable. Some cables can only charge and cannot carry data. Then try another USB port.
- Only part of my name shows.Wait for it to finish scrolling. Long names take a few seconds.
Where it sits in CAPS
- Coding and RoboticsAlignedGrade 5, Term 3: code the micro:bit to show something different for each button, in the on-screen simulator.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 5, Term 3, Robotics, R.6 Mimic the operations of a robot, page 113:
Write code to display the following images using different inputs
- Coding and RoboticsAlignedGrade 5, Term 3: a computing device takes input, processes it and gives output, as the micro:bit does.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 5, Term 3, Digital Concepts, D.1 Outline the concept of technology and purpose of information technology (IT), page 115:
Computing devices (including the concept of input, processing and output)
- Coding and RoboticsAlignedGrade 5, Term 3: test the program in the MakeCode simulator. In Grade 5 the CAPS works on screen only; a real board is a bonus.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 5, Term 3, Digital Concepts, D.10 Demonstrate a basic proficiency in the application of digital skills, page 117:
Microcontroller simulator with LED matrix (simulates/outputs the result of your coding on the microcontroller).
- Coding and RoboticsFitsGrade 4, Term 1: a computer takes input, processes it and gives output. Here the input is a button and the output is the display.Source: Coding and Robotics CAPS, Grades 4 to 6, Grade 4, Term 1, Digital Concepts, D.7 Present a basic understanding of the concept of input processing and output, page 64:
the three main steps that occur in a computer or any other device
- Coding and RoboticsSupportsGrade 3, Term 3: the CAPS teaches this unplugged; the robot teacher activity is the Grade 3 part, and the board is extra.Source: Coding and Robotics CAPS, Grades R to 3, Grade 3, Term 3, Digital Concepts, D.7 Present a basic understanding of the concept of input processing and output, page 113:
Learners need to understand that a computing device receives input, processes the input, and provide output
Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.
micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

