A learning resource fromSpread Robotics Education Foundation

Lesson 05 · 55 minutes · Buttons and events

Build an emotion badge

Press a button and make something happen. The micro:bit will show a different face for A and B.

New programming concepts

Input, output, and event

Input

Information entering the computer. A button press is an input.

Event

Something the program notices. “Button A pressed” is an event.

Output

Something the computer produces. The face on the LEDs is an output.

Press A
input
Program notices
event
Happy face
output

Try it here

Choose the input

AB

Select the same input your program will notice.

Button A shows a happy face.

MakeCode steps

Build the badge

  1. 1

    Start a new project

    Name it Emotion Badge.

    Open MakeCode
  2. 2

    Add the A event

    Open Input. Drag on button A pressed into the workspace.

  3. 3

    Choose A’s output

    Inside that event, add show icon and choose the happy face.

  4. 4

    Add the B event

    Add on button B pressed. Inside it, show the sad face.

  5. 5

    Test each path

    Press A and B on the simulator. Say the input and output aloud each time.

  6. 6

    Personalize

    Choose any two respectful icons: ready/not ready, yes/no, or two feelings.

Optional videos

Watch the official guides

Visit the official Emotion badge project

For the teacher

A calm 55-minute plan

Act it out
Teacher says “A”; class shows a happy face.

Name the flow
Input → event → output.

Guided build
Complete A before adding B.

Test and transfer
Every team member presses both buttons.

Personalize
Change one icon and explain why.

Inclusive classroom use

Do not require learners to disclose real feelings. Teams can code classroom signals, yes/no responses, or fictional character emotions instead.

Before you finish

Can you explain it?