This is an optional extension activity after the teaching of binary numbers.
In the introductory arithmetic module, students learn the four operations of numbers, the PEMDAS or BODMAS rule, Laws of Arithmetic (eg commutative, associative, distributive laws). They also learn about the different number systems.
In the topic of binary, students learn how to convert decimal to binary and binary back to numbers.
This lesson is to be conducted after the teaching of the methods of conversion as a form of formative assessment and feedback in an engaging pair activity, making use of microbits.
1. A classroom set of microbits so that each student will have one microbit for the activity.
2. Predownload the code into the microbit or share the programme with the class for them to download the programme during lesson time.
3. Pairwork setting class seating arrangement or you may get them to form pairs based on their current seating plan.
Students to
* be able to convert decimals to binary
* be given the opportunity to create similar code to convert decimal to other bases of their choices as enrichment activity.
I learn that use of microbits can also be further explored as a possible gamification of our teaching concepts.
Binary Game in MakeCode - How to play A classroom set of microbits is to be prepared so that each student will have a microbit to play the Binary Game with a partner.
Binary Game Instruction
The Input (Micro:bit 1):
The first student taps Button A (0) or Button B (1). After 5 taps, the micro:bit will start scrolling the sequence they entered (e.g., 01011).
The Transmission:
Once the first student is ready, they press A and B together. This sends the decimal calculation (e.g., 11) through the air.
The Challenge (Micro:bit 2):
The second student’s micro:bit will suddenly start scrolling the decimal number.
They must then mentally convert it back to binary and tell their partner.
Verification: Student 1 checks if the answer matches the binary code still scrolling on their screen.
Reset: Both students press A and B to clear their screens and start a new round.
Note: Pair are to stand within 10-20 meters of each other for the radio signal to stay strong!
Game Link in MakeCode Code can be shared with students for them to download in class during the lesson or the code can be predownloaded into the microbits before the lesson.
https://colab.research.google.com/drive/1EDz1vuNUbrxrfmEY4o3yXnZhAO8oNqBi
from microbit import *
import radio
# Initialize radio
radio.on()
radio.config(group=1) # Ensure both micro:bits are on the same group
# Game States
STATE_INPUT = 0
STATE_DISPLAY_BINARY = 1
STATE_WAITING = 2
state = STATE_INPUT
binary_input = “”
decimal_value = 0
def reset_game():
global binary_input, decimal_value, state
binary_input = “”
decimal_value = 0
state = STATE_INPUT
display.show(“?”)
sleep(500)
display.clear()
display.show(“?”)
while True:
# 1. RECEIVE MODE: Always check if a number is being sent from another micro:bit
incoming = radio.receive()
if incoming:
# If we receive a message, we switch to Receiver mode (Micro:bit 2)
display.scroll(“DEC: “ + incoming, delay=100, loop=True, wait=False)
state = STATE_WAITING
# 2. SENDER MODE (Micro:bit 1 logic)
if state == STATE_INPUT:
# Input 5 digits
if button_a.was_pressed():
binary_input += “0”
display.show(“0”)
sleep(300)
display.clear()
elif button_b.was_pressed():
binary_input += “1”
display.show(“1”)
sleep(300)
display.clear()
# Check if 5 digits reached
if len(binary_input) == 5:
# Calculate decimal equivalent
decimal_value = int(binary_input, 2)
state = STATE_DISPLAY_BINARY
elif state == STATE_DISPLAY_BINARY:
# Display the binary number continuously
display.show(binary_input, delay=600, loop=True, wait=False)
# Wait for A+B to send to Micro:bit 2
if button_a.is_pressed() and button_b.is_pressed():
radio.send(str(decimal_value))
display.show(Image.YES) # Confirmation icon
sleep(1000)
display.show(“SENT”)
state = STATE_WAITING
# 3. GLOBAL RESET (Works for both sender and receiver)
if button_a.is_pressed() and button_b.is_pressed():
if state == STATE_WAITING:
reset_game()
Video Link of Game Play in Action
Binary Game Activity in Class, in Pairs
* Microbits are issued
* Students to get in pairs
* For groups of three, the third person will be help to verify the answers shared by Player 2 before he or she submits.
* After each student attempts 3 rounds of binary questions, each pair to move on to Part II
Coding Challenge Instruction
1. Class Discussion of the Code for Binary Conversion
Linking to the method of conversion taught in class
2. Class Discussion on Different Bases
Instruction for the optional class activity offer to the whole class for those who are interested to attempt to create similar code to convert decimal to other bases of their choices as enrichment activity.
Optional Enrichment Task - Coding the Game for the Different Bases
Invite students who have attempted to create the code for the different bases to share their Game in the next lesson or when they are ready.
Having trouble? Let us know by completing the form below. We'll do our best to get your issues resolved quickly.
"*" indicates required fields