# Radio messages: a free micro:bit lesson from Maze Education
# https://maze.education/microbit/lessons/radio-messages
# MicroPython for the micro:bit Python Editor: https://python.microbit.org

# Radio messages: A sends YES, B sends NO, and messages from the same group scroll past.
from microbit import *
import radio

radio.on()
radio.config(group=1)
while True:
    if button_a.was_pressed():
        radio.send("YES")
    if button_b.was_pressed():
        radio.send("NO")
    message = radio.receive()
    if message:
        display.scroll(message)
    sleep(20)
