# Microbit Radio ###### tags: `microbit` `radio` ## 使用Microbit Radio ![](https://i.imgur.com/2ygq0Vy.png) ++Device A:++ ==Radio_A.py== ```python= # Write your code here :-) # A micro:bit Firefly. # By Nicholas H.Tollervey. Released to the public domain. import radio import random from microbit import display, Image, button_a, sleep # The radio won't work unless it's switched on. radio.on() #設定Channel及惟一相對的32-bit address radio.config(channel=9,address=0xe369fb16) # Event loop. while True: # Button A sends a "flash" message. if button_a.was_pressed(): radio.send('FROM-A') # a-ha # Read any incoming messages. incoming = radio.receive() if incoming == 'FROM-B': display.show(incoming) ``` ++Device B:++ ==Radio_B.py== ```python= # Write your code here :-) # A micro:bit Firefly. # By Nicholas H.Tollervey. Released to the public domain. import radio import random from microbit import display, Image, button_a, sleep # The radio won't work unless it's switched on. radio.on() #設定Channel及惟一相對的32-bit address radio.config(channel=9,address=0xe369fb16) # Event loop. while True: # Button A sends a "flash" message. if button_a.was_pressed(): radio.send('FROM-B') # a-ha # Read any incoming messages. incoming = radio.receive() if incoming == 'FROM-A': display.show(incoming) # Write your code here :-) ```