Intermediate
60 mins
Teacher/Student led
+75 XP

Program a Micro:bit: Follow Precise Instructions

Learn how a micro:bit follows exact instructions by programming it to display an icon when a button is pressed. Identify the input, process and output, then debug any errors in your code.

Teacher Class Feed

Load previous activity

    1 - Getting Started ~5 mins

    Key point

    A micro:bit only does exactly what we tell it. If our instructions are missing a step or name the wrong button, it will not guess what we meant.

    Illustration for Getting StartedBy the end of today your micro:bit should light a heart, or a letter you choose, only when the right button is pressed. What must our instructions say clearly before we press Run?

    2 - Name the Input, Process and Output ~7 mins

    Look at the board. The micro:bit has two buttons: A and B. Its LED screen can show icons such as a heart or a smile, or a single letter such as H.

    Here is one shared plan we can all start from:

    Example

    Input: press button A.
    Process: when button A is pressed, show a heart.
    Output: a heart lights up on the LED screen.

    With your partner, choose your plan. You may keep button A and the heart, or pick button B and a different icon or letter. Say your input, process and output in plain words.

    3 - Watch the First Working Program ~8 mins

    Watch the board. Before anything is downloaded, predict: when the teacher presses button A, what should appear on the micro:bit screen?

    Key point

    Notice the three parts: the input the program listens for (button A), the process blocks in order (when button A is pressed, show heart), and the output on the LEDs (a heart).

    Note

    If something goes wrong, that mistake is called a bug. Finding and fixing it is debugging. Watch one small bug get fixed live.

    4 - Program and Debug on the Micro:bit ~25 mins

    Key point

    With your partner, build the program on your device. Keep this checklist on the board in mind: input (which button?), process (which blocks, in order?), output (what should light up?).

    Follow these steps:

    1. Open the MakeCode micro:bit editor on your tablet or laptop.
    2. Drag on button A pressed (or button B if that is your plan) from Input.
    3. Inside it, drag show icon and choose a heart, or show string and type one letter.
    4. Download to your micro:bit (or press play in the simulator) and press the button you chose.
    5. If it misbehaves, change one thing only, then test again.
    Tip

    Most programs need a fix the first time. That is normal. Finding the bug is part of the job. Keep asking: what is the input, what is the process, and what output should we see?

    5 - Record Your Steps ~10 mins

    Key point

    On your Investigation Journal page, write your program as clear steps: the input, the process and the output. That list of precise steps is your algorithm.

    Add one bug you found and how you fixed it.

    Pupil practice · Investigation Journal
    Module 4 · Technology: Inputs, Algorithms and Coding on Devices
    Lesson 27 · Program a Micro:bit: Follow Precise Instructions
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2025. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more