Reaction Game using Micro:bit – SCOPES-DF

Lesson Details

Age Ranges *

Author

David Fernandez Menendez
David Fernandez Menendez

Summary

This lesson works better if students had some previous experience working with Scratch or similar coding software.

The lesson focuses on students creating a reaction game with simple materials and using a Microbit microcontroller to program the game.

What You'll Need

Materials needed

  • a micro:bit
  • a laptop and Makecode
  • crocodile clips
  • cardboard
  • aluminum foil
  • glue stick 
  • scissors

 

Learning Objectives

By the end of the lesson, students will be able to:

  1. Build and connect a simple reaction game circuit using a microcontroller and external buttons/inputs.
  2. Identify and use inputs (e.g. pins) and outputs (LED display) in their project.
  3. Use event-based programming blocks (such as “when pin pressed”) together with variables and simple Boolean logic (true/false) to control the game and prevent false starts.
  4. Work effectively in pairs, sharing roles to design, code, test and improve their reaction game.

 

Reflection

Through this task I developed my ability to design and teach an engaging lesson that introduces basic electronics and coding concepts through a practical and hand-on activity.

The Instructions

Starter. Check for prior knowledge

Starter activity to introduce the micro:bit and make a very simple code to show the coding environment and how to downloaded to the microcontroller.

Show a very simple MakeCode program on the board

Ask: “What do you think this will do?” Then run it on the micro:bit.

Briefly explain: micro:bit, inputs, outputs, and block coding interface.

 

 

 

 

 

Introduce the Reaction Game challenge

Present the two-player reaction game, learning objectives, and success criteria.

Show a short demo of the reaction game.

Explain the challenge:

  • Two players each have a button.
  • After a random delay, an icon appears.
  • First player to press their button wins; the micro:bit shows “A” or “B”.

Highlight key ideas: input (pins), output (LED display), random delay and variables.

Build the circuit

Students create simple external buttons using craft materials and connect them to the micro:bit pins.

Give each pair: micro:bit, crocodile clips, cardboard, aluminium foil and glue or tape.

Model connecting:

  • Player A button → pin P1
  • Player B button → pin P2
  • Common connection → GND

Ask students to build and connect their own buttons, following a simple diagram on the board.

Code the Reaction Game

Students create the core reaction game program using variables, random pause, and a loop to check for button presses.

Ask students to open MakeCode and create a new project called “Reaction Game”.

Provide a partially completed starter file or show the blocks step by step:

  1. Inside a forever block, set variable “game_started” to false.
  2. Add a pause (ms) with pick random 1000 to 5000.
  3. Set “game_started” to true and show icon as the “go” signal.
  4. Add a while game_started loop.
  5. Inside the loop:
  6. if pin P1 is pressed then show string “A” and set “game_started” to false
  7. else if pin P2 is pressed then show string “B” and set “game_started” to false
  8. After the while loop, add a short pause and clear screen.

 

 

 

Link to code: https://makecode.microbit.org/S69668-42472-58413-57435

Test, debug & play

Students test their reaction game, fix problems, and reflect on how to make it fair and fun.

Ask pairs to test their game several times

If it does not work as expected, guide them to:

  • Check wiring (P1, P2, GND).
  • Check the value of “game_started” and the order of blocks.

 

Briefly discuss as a class:

  • What made the game fair?
  • How did the code prevent both players winning at once?

Extension Activity

Optional challenges to extend students who finish early or need extra stretch.

Students may choose one or more of the following:

  1. Add and show a countdown.
  2. Show the reaction time
  3. Show a “False Start” when a player touches the button before the “go” signal
  4. Show a random LED to show the start of the game
  5. Use the touch Logo button on the Microbit to start each round.

 

Students may need to use more variables: start, end and false start to complete the extension activities.

Here there is an example of how the code may be completed implementing the extensions above.

 

Link to code:

https://makecode.microbit.org/S12069-63539-84458-62087

Lesson Feedback

Contact us

Having trouble? Let us know by completing the form below. We'll do our best to get your issues resolved quickly.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.
Name*
Email*
?