AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Messages without wires

Week 15 · 1.8 Physical computing · 3 lessons
2

Same group, same message

Computing 8: Topic 1.8, pp. 173–196
GoalSet a radio group and send numbers and text between two micro:bits, and trace what each one shows.
New words
radio group · a number set with radio set group; only micro:bits with the same group hear each otherradio send number · sends one number to every micro:bit in the same groupon radio received · a block of code that runs when a message arrivesvariable · a named place that stores a value, such as count
Explanation

A micro:bit program is built from blocks. For radio, the first step is radio set group, put in the on start block. Both micro:bits must use the same group number, because only the same group can hear each other. Then the sender uses radio send number to send a number, or radio send string to send a word. On the receiving micro:bit, the on radio received block runs when a message arrives, and the value is held in receivedNumber or receivedString. The program can show that value on the lights. A variable can also be sent. If count is 3, then radio send number (count) sends 3. Trace each press carefully, and say which micro:bit shows what.

Worked examples
Senderradio set group5on startradio send number7on buttonApressedradio send number2on buttonBpressedReceiverradio set group5on startshow numberreceivedNumberon radio receivedreceivedNumber
A sender and a receiver in group 5. Button A sends 7 and button B sends 2. The receiver shows the number that arrived. If A, B and then A are pressed, the receiver shows 7, then 2, then 7.
Eventcount after the pressNumber sentReceiver shows
press A (1)111
press A (2)222
press A (3)333
A sender that counts. The variable count starts at 0. Every press of A adds 1 and sends the new count. The table shows three presses of A. The receiver shows what was sent.
Senderradio set group5on startradio send stringGoon buttonApressedReceiverradio set group5on startshow stringreceivedStringon radio receivedreceivedString
Sending text. Button A sends the word Go. The receiver shows the string it received. If the receiver were in group 6, nothing would arrive, because the groups are different.
Class activity

Be the micro:bits (no computer). Two players write their group number on a card and sit back to back. Player 1 is the sender and has two number cards, one for button A (for example 4) and one for button B (for example 9). The receiver writes down the number that is called out. If the group cards do not match, the receiver must not write anything. Do a short sequence: A, B, A, A. Then swap roles and use new numbers. Draw the block program for each player. If you have a computer or tablet, ask an adult to help you open the block editor for the micro:bit.

Practice
1
Trace the programs. The buttons are pressed in the order B, A, B. What does the receiver show after each press?
Senderradio set group2on startradio send number3on buttonApressedradio send number6on buttonBpressedReceiverradio set group2on startshow numberreceivedNumberon radio receivedreceivedNumber
2
The sender uses group 4 and the receiver uses group 8. A is pressed three times. What does the receiver show, and why?
Senderradio set group4on startradio send number5on buttonApressedReceiverradio set group8on startshow numberreceivedNumberon radio receivedreceivedNumber
3
Describe the blocks a sender needs so that button B sends the word Stop to group 9. Which block does the receiver use to hold the word?
4
The count program changes count by 2 each time A is pressed, starting at 0, and sends the new count. What does the receiver show after three presses?
Senderradio set group3setcountto0on startchangecountby2radio send numbercounton buttonApressed