Skip to content


Hot and cold game

Intermediate | MakeCode, Python | Buttons, LED display, Radio | Communication, Data types

Step 1: Make it

What is it?

Make this fun two-player game using the BBC micro:bit’s radio feature.

What you'll learn

By making this project you will learn about networks, how information is sent between electronic devices by radio, and how computers store information in different data types such as how words are stored in strings.

How it works

  • This is a game for two people. One person hides an object and gives the seeker clues: ‘hot’ when they are close to the object, ‘colder’ when they are moving further away, and ‘warmer’ when they are getting closer.
  • Usually, this game is played by shouting the words ‘hot’, ‘colder’ and ‘warmer’ but in this version of the game the words are sent by radio from one micro:bit to another and appear on the LED display.
  • There are two programs, one for the hider and one for the seeker.
  • First, each program sets the radio group to 47. Groups are like channels, so any micro:bit using the same group will get the message. You can use any group number you like from 0-255.
  • The hider presses button A to send the message ‘warmer’, presses button B to send the message ‘colder’ and presses buttons A and B together to send the message ‘hot’.
  • The micro:bit can send messages as numbers or text. We’re using text messages in this project, so make sure you use radio blocks that refer to strings rather than numbers or values.
  • In computing, a string is a sequence of characters that can contain letters, numbers, symbols, and spaces.
  • When the seeker's micro:bit receives a radio message, it shows the string received on its LED display. The strings are also displayed on the hider’s micro:bit.

What you need

  • 2 micro:bits
  • MakeCode editor
  • battery packs (recommended)

Step 2: code it

Hider code

1# Imports go at the top
2from microbit import *
3import radio
7while True:
8    if button_a.is_pressed() and button_b.is_pressed():
9            radio.send('HOT!')
10            display.scroll('HOT!')
11    elif button_a.is_pressed():
12        radio.send('warmer')
13        display.scroll('warmer')
14    elif button_b.is_pressed():
15        radio.send('colder')
16        display.scroll('colder')
17    sleep(100)

Seeker code

1# Imports go at the top
2from microbit import *
3import radio
7while True:
8    message = radio.receive()
9    if message:
10        display.scroll(message)
11    sleep(100)

Step 3: improve it

  1. Edit the program so that different words appear instead of 'hot', 'colder' and 'warmer'. For example, you could use the words for 'hot', 'colder' and 'warmer' in a foreign language you are learning.
  2. Add sound effects to the program.
  3. Use this game with a timer or step counter program to see how quickly you found the object.