Hot-Cold Game with CHARGE Power Pack
Introducing the Hot-Cold Game
Play the Hot and Cold game without needing to talk! Using the micro:bits and CHARGE Power Packs, you and a partner can silently hide and find objects from each other while giving hints based on how close the seeker is to the object by sending a “warmer” or “colder” message. When they’re really close, press both buttons on the micro:bit to send the “HOT” message!
What you need:
With CHARGE for micro:bit
- 2x micro:bits (V1 or V2)
- USB cable
- Chromebook, laptop, or desktop
- Access to MakeCode
- 2x CHARGE w/ wrist strap
Without CHARGE
- 2 micro:bits (V1 or V2)
- USB cable
- Chromebook, laptop, or desktop
- Access to MakeCode
- 2x Power bank or battery pack
- 2x Wrist strap, clips, tape, elastic bands
Code your Hot-Cold Game:
This project has a simple version and a complex version. The Level 1 Code allows the Hider to send the words “Cold” “Warmer” and “Hot” to the Seeker, while the Level 2 Code allows the Hider to light up the number of LEDs more or less depending on how close the Seeker is.
Level 1 Code:
- Open makecode.microbit.org
- Radio drawer: add “radio set group 1” to “on start” and set the group to a number between 1-255. If you’re playing this near other pairs, make sure you’re not using the same group number.
- Input drawer: add “on button A pressed”
- Radio drawer: add “radio send string “ “” to “on button A pressed.”
- Basic drawer: add “show string “ “” to “on button A pressed.”
- Write in both empty strings “warmer”
- Copy & Paste “on button A pressed”
- Change A to B
- Change “warmer” to “colder”
- Paste “on button A pressed”
- Change A to A+B
- Change “warmer” to “HOT”
- Radio drawer: add “on radio received receivedString”
- Basic drawer: add “show string “ “”. Drag “receivedString” and drop it onto the blank string.
- Plug in your micro:bit, pair, download your code and test!
Or experiment with the finished code here:
Level 2 Code:
- Open makecode.microbit.org
- Radio drawer: add “radio set group 1” to “on start” and set the group to a number between 1-255. If you’re playing this near other pairs, make sure you’re not using the same group number.
- Variables drawer: “Make a Variable” and name it something like temperature.
- Variables drawer: add “set temperature to 0” to “on start”
- Radio drawer: add “radio send number 0” to “on start”
- Variables drawer: grab the temperature variable and drop it onto the 0 in “radio send number 0”
- Logic drawer: add “if true then, else” to “forever”
- Logic drawer: grab “0 < 0” and drop it onto “true” in the if statement.
- Variables drawer: grab the temperature variable and drop it onto the 0 and change the second 0 to 0.9. The equation should now read “if temperature < 0.9 then”
- Basic drawer: add “clear screen” to the if statement.
- Led drawer: add “plot bar graph” to the “else” statement.
- Copy & Paste the temperature variable, drop it on the first 0 and change the second 0 to 5. The block should now read “plot bar graph of temperature up to 5”
- Input drawer: add “on button A pressed”
- Variables drawer: add “change temperature by 0” to “on button A pressed” and change 0 to 0.9.
- Logic drawer: add “if true then, else” below “change temperature by 0.9”
- Copy & Paste the comparison block from the “forever” block, drop the block onto true of the if codeblock. Change the comparison block to “temperature > 4.5”
- Variables drawer: add “set temperature to 0” to the if statement. Change 0 to 4.5.
- Radio drawer: add “radio send number 0” below the if codeblock.
- Copy & Paste the temperature variable and drop it on the 0 of “radio send number 0”
- Copy & Paste the “on button A pressed” code block. Change button A to B.
- Change “change temperature by 0.9” to “change temperature by -0.9”
- Change “temperature > 4.5” to “temperature < 0”
- Change “set temperature to 4.5” to “set temperature to 0”
- Radio drawer: add “On radio received receivedNumber”
- Variable drawer: add “set temperature to 0” to “on radio received.” Drag “receivedNumber” and drop it onto 0.
- Plug in your micro:bit, pair, download your code onto both micro:bits and test!
Or experiment with the finished code here:
Play the Hot-Cold Game:
Now turn on your CHARGE power packs, and have the Hider hide an object from the Seeker. Now the Seeker can start searching for the object while the Hider sends messages to the Seeker letting them know if they’re getting closer by pressing the A button (warmer) or farther away by pressing the B button (colder) from the hidden object. Press A & B (Hot) when the Seeker is right on top of it!
If you’re coding with the Level 2 Code, the Hider can press the A button to increase the amount of LEDs lit when the Seeker gets closer or press the B button to decrease the number of LEDs when the Seeker gets farther away.
Make it better:
Do the messages take too long to display? Maybe try displaying icons or playing sounds instead so the Seeker gets more real-time information. If you completed the Level 1 code, try the Level 2 code that shows how close the Seeker is a scale.