The sender micro:bit and receiver micro:bit each have their own script, and they must be running at the same time.
Example Sender Script: countdown_sender
# countdown_sender
from microbit import *
import radio
radio.on()
radio.config(channel=7,length=50)
sleep(1000)
print("Countdown App")
print("micro:bit sender")
while True:
text = input("Enter countdown start: ")
value = int(text)
message = input("Enter message after countdown: ")
dictionary = { }
dictionary['start'] = value
dictionary['after'] = message
packet = str(dictionary)
print("Send: ", packet)
radio.send(packet)
print()
Example Receiver Script: countdown_receiver
# countdown_receiver
from microbit import *
import radio
radio.on()
radio.config(channel=7,length=50)
sleep(1000)
print("Countdown App")
print("micro:bit receiver\n")
while True:
packet = radio.receive()
if packet is not None:
print("Receive: ", packet)
print()
print("Parse: ")
dictionary = eval(packet)
value = dictionary['start']
message = dictionary['after']
print("value = ", value)
print("message = ", message, "\n")
while value >= 0:
print(value)
sleep(1000)
value = value - 1
print(message)
print()
