{"base":{"id":"cs8-10","subject":"Programming","title":"Devices that talk","scene":"network","steps":[{"mode":"radio","eyebrow":"Radio groups","title":"Tune in to the same group","body":"Two small boards can send messages by radio. A board only listens to its own group number. Press send, then change the sender's group until the receiver gets the number.","controls":[{"id":"group","label":"Sender's radio group","min":0,"max":5,"step":1,"value":0}],"actions":[{"id":"send","label":"Press button A: send a number"}]},{"mode":"text","eyebrow":"Sending text","title":"Words travel as numbers","body":"Messages can be words. Each letter is sent as a number code, and the receiver turns the codes back into letters. Send each word and look at its codes.","actions":[{"id":"hi","label":"Send “Hi”"},{"id":"yes","label":"Send “Yes”"},{"id":"bye","label":"Send “Bye”"}]},{"mode":"respond","eyebrow":"Responding","title":"Test with different messages","body":"The receiver's program uses if, elif and else to choose a picture. One test is not enough: try every message, including one it doesn't expect, and check the results.","actions":[{"id":"wave","label":"Send “wave”"},{"id":"stop","label":"Send “stop”"},{"id":"hello","label":"Send “hello”"}]},{"mode":"quiz","look":"radio","eyebrow":"Check yourself","title":"Nothing arrives","body":"Ana's board sends on group 3. Ben's board listens on group 4. Ben's board never shows anything.","question":"What is the most likely fix?","options":["Press the button harder","Send longer messages","Put both boards on the same group"],"answer":2,"right":"Correct. A receiver ignores every group except its own, so both must use the same number.","wrong":"Not quite. Look at the two group numbers."}],"more":[{"type":"cards","id":"code","eyebrow":"The programs","title":"Sender and receiver code","items":[{"tag":"Sender","title":"Send a number when A is pressed","body":"radio.on()\nradio.config(group=1)\ncount = 0\nwhile True:\n    if button_a.was_pressed():\n        count = count + 1\n        radio.send(str(count))","code":true},{"tag":"Receiver","title":"Show what arrives","body":"radio.on()\nradio.config(group=1)\nwhile True:\n    msg = radio.receive()\n    if msg:\n        display.show(msg)","code":true},{"tag":"Responding","title":"Choose a picture","body":"if msg == \"wave\":\n    display.show(Image.HAPPY)\nelif msg == \"stop\":\n    display.show(Image.NO)\nelse:\n    display.show(\"?\")","code":true}]},{"type":"cards","id":"ideas","eyebrow":"Popular idea vs science","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"\"The receiver hears every board in the room.\"","body":"It only listens to its own group, so a whole class can work at once without mixing messages."},{"tag":"Popular idea","title":"\"It worked once, so the program is finished.\"","body":"Each message can take a different path through the code. Test every path, and a message it doesn't expect."},{"tag":"Popular idea","title":"\"“Wave” and “wave” are the same.\"","body":"To a computer, a capital W is a different code from a small w, so the test fails."}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Torch messenger","items":[{"title":"Light-flash radio","time":"20 minutes","need":["Two torches or phone torches","A partner","Paper and a pen"],"steps":["Agree on a 'group': a secret starting signal, such as two quick flashes. Only messages that start with it count.","Agree on codes: 1 flash = 'yes', 2 = 'no', 3 = 'come here'.","Stand across a dark room. Send messages and let your partner act on them.","Try sending a message without the group signal. Your partner should ignore it."],"why":"Real radios work the same way: both sides must agree on the group and on what each code means.","safety":"Never shine a torch into someone's eyes."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Six more questions","questions":[{"question":"What is the radio group for?","options":["It sets the volume","It makes messages longer","Only boards on the same group hear each other"],"answer":2,"right":"Correct. The group is like a channel number.","wrong":"Not quite. Think about many pairs working in one room."},{"question":"Which part of the sender's program reacts to the button?","options":["display.show(msg)","if button_a.was_pressed():","radio.receive()"],"answer":1,"right":"Correct. That line checks the input before sending.","wrong":"Not quite. Look for the line about button A."},{"question":"How does a letter travel by radio?","options":["As a number code sent in bits","As a drawing","As a sound"],"answer":0,"right":"Correct. Each character has a number code, sent as bits.","wrong":"Not quite. Computers turn letters into numbers."},{"question":"The receiver gets “hello”. Its code checks for “wave” and “stop” only. What runs?","options":["The else part","The if part","The elif part"],"answer":0,"right":"Correct. Neither test matched, so the else part runs.","wrong":"Not quite. Did either condition match?"},{"question":"Why test with a message the receiver doesn't expect?","options":["To waste time","To check the else part works","To change the group"],"answer":1,"right":"Correct. Every path through the program needs testing.","wrong":"Not quite. Which part of the code would it test?"},{"question":"A pair of boards fails to talk. Which is NOT a likely cause?","options":["The screen is too bright","Different groups","Radio not switched on"],"answer":0,"right":"Correct. Brightness doesn't affect the radio.","wrong":"Not quite. Which one has nothing to do with sending or receiving?"}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can explain…","items":["the job of the sender and the receiver","why both boards need the same radio group","how text is sent as number codes","how a receiver uses if, elif and else to respond","why two devices must be tested together with several messages"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"microcontroller","meaning":"A small programmable board with inputs and outputs."},{"word":"input","meaning":"Something the device senses, such as a button press or a radio message."},{"word":"output","meaning":"Something the device does, such as lighting LEDs or sending a message."},{"word":"radio group","meaning":"A channel number; boards only hear messages on their own group."},{"word":"sender","meaning":"The device that transmits a message."},{"word":"receiver","meaning":"The device that picks up the message and responds."}]},{"type":"sources","id":"sources","title":"Sources","items":["Micro:bit Educational Foundation: MicroPython radio documentation","BBC Bitesize KS3 Computing: Physical computing"]}]},"overlay":null}