Name badge

A first program: the micro:bit says hello, then shows the learner's name at the press of a button.

Go to the code ↓

Lesson at a glance

45 to 60 minutes · Grades 3 to 5

maze.education/microbit/lessons/name-badge

Grades
Grades 3 to 5
Time
45 to 60 minutes
The 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 started
A 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 Robotics
Aligned: Grade 5, Term 3 · Where it fits

Learning intentions

Learners will learn to:

  1. Explain that a micro:bit is a small computer that follows instructions in order.
  2. Use an event, a button press, to start part of a program.
  3. 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.

  1. Introduction

    5 to 10 minutes
    Retrieval practice

    What is an algorithm? (Clear steps, in the right order, that solve a problem, such as the steps for making a cup of tea.)

    Problem statement

    On 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.

    1. 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.
    2. Read the problem statement together. Ask: what should the badge show when nobody presses anything?
  2. Lesson development

    35 to 40 minutes
    1. 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.
    2. 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.
    3. 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?
    4. 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.
    5. 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.
    6. 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
    InputProcessingOutput
    The micro:bit is switched onRun the blocks in on start, onceHi! scrolls across the display
    Button A is pressedRun the blocks in on button A pressedThe name scrolls across the display
    Button B is pressedRun the blocks in on button B pressedA picture (an icon) shows
  3. Consolidation

    5 to 10 minutes
    1. Ask: in our program, what are the inputs and what are the outputs? Point to the rows of the IPO table.
    2. Two or three learners show their badges and say what they changed.
    3. 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.

Three rows: on start the board scrolls Hi!, button A scrolls the name Sam, and button B shows a happy face on the 5 by 5 lights.
Each event starts its own blocks: on start runs once, and each button runs its blocks every time it is pressed.

These are the MakeCode steps. The other routes are on the lesson's web page.

Build it in MakeCode blocks

  1. Go to makecode.microbit.org, click New Project and call it Name badge.
  2. From Basic, drag show string into on start and change Hello! to Hi!
  3. From Input, drag on button A pressed onto the workspace.
  4. From Basic, drag another show string into on button A pressed and type your name.
  5. Drag in a second on button A pressed, click the A and change it to B.
  6. From Basic, drag show icon into the B block and pick a picture.
  7. 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.
The same blocks as text (to paste into MakeCode)
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.

Extension or homework

Challenges for learners who finish early, or to take further in a club or as homework.

  1. Challenge 1

    Make the badge say hello in another language the class speaks, such as Sawubona, Molo or Dumela, before your name.

  2. Challenge 2

    Add on button A+B pressed to show your age or your favourite number with show number.

  3. 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.

  1. What is a program?
  2. Which block runs as soon as the micro:bit gets power?
  3. Name one input and one output on the micro:bit.
Exit question

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 forBeginningDevelopingAccomplishedExemplary
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

  • Problem: Nothing happens when I press A.Fix: 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.
  • Problem: The MICROBIT drive does not appear.Fix: Try another USB cable. Some cables can only charge and cannot carry data. Then try another USB port.
  • Problem: Only part of my name shows.Fix: 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 (opens in a new tab), 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 (opens in a new tab), 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 (opens in a new tab), 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 (opens in a new tab), 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 (opens in a new tab), 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.

Ready to teach it?

Get a micro:bit for every learner or pair, and let us train your staff to run lessons like this one.

More lessons

All lessons →
  • Grades 3 to 5

    Grades 3 to 545 to 60 minLevel: Getting started

    Emotion badge

    Learners make a badge that shows how they feel, with a different face for each button and for a shake.

    Subjects: Coding and Robotics · Life Skills

    Code with: MakeCodePurple MashPython

  • Grades 3 to 5

    Grades 3 to 545 to 60 minLevel: Getting started

    Beating heart

    A big heart and a small heart take turns forever: learners meet loops, timing and animation.

    Subjects: Coding and Robotics

    Code with: MakeCodePurple MashPython

  • Grades 3 to 6Needs a micro:bit V2

    Grades 3 to 6Needs a micro:bit V245 to 60 minLevel: Getting started

    Sound-reactive light show

    The micro:bit V2 listens through its microphone: lights sparkle brighter as the room gets louder, and a clap sets off a flash.

    Subjects: Coding and Robotics · Creative Arts · Natural Sciences and Technology

    Code with: MakeCodePython

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.

WhatsApp