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.
Mathematics
Students to
Part I
* be able to convert decimals to binary
Part II
* be given the opportunity to explore converting to decimal to other bases of their choice as extension activity.
Computing
Students to
* be able to appreciate the use of binary in computer.
* be able to understand the code to convert decimal and binary
* be able to write the code to convert decimal to other bases (Optional enrichment)
I learnt that the use of microbits can be further explored as a possible gamification in our teaching of concepts such as binary in this lesson. This allows the multi-disciplines learning experiences for our students.
More in depth reflection and rubrics can be found here.
Pre Activity Mathematics Teaching After the mathematics lesson in which students are taught how to convert decimals to binary and vice versa. Students are told that they will be having a formative quiz in the next lesson and given the optional task to explore the method of converting to decimal to other bases of their choice as extension activity.
Some of the learning resources for the teaching of binary is available here:
Video 1:
Introductory Video on Binary
https://www.youtube.com/watch?v=Xpk67YzOn5w
Why Do Computers Use 1s and 0s? Binary and Transistors Explained.
This video allows students to have meaningfully connection on the learning of binary and coding.
Video 2:
Convert decimal to binary by dividing by 2
https://youtu.be/C6l7F6C4bIA?si=r4ZeNpWAkFTVqwT2
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.
Pre Activity Preparation
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.
Pre Activity Information for Teacher
Binary Game in MakeCode – Teacher to be familar on the game play
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!
Binary Game Code:
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
Based on students’ readiness or class profile, teacher may choose to show this video to the class at the start of the lesson so that they will know how to play the Binary Game.
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 both students attempt 3 rounds of binary questions, the pair will 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 offered 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