22 lines
503 B
Python
22 lines
503 B
Python
from microbit import *
|
|
import radio
|
|
|
|
# Tænd radioen og vælg en kanal
|
|
radio.on()
|
|
radio.config(channel=7)
|
|
|
|
while True:
|
|
# Send besked med knap A
|
|
if button_a.was_pressed():
|
|
radio.send("Hej der!")
|
|
display.scroll("Sendt!")
|
|
|
|
# Send besked med knap B
|
|
if button_b.was_pressed():
|
|
radio.send("Hvordan går det?")
|
|
display.scroll("Sendt!")
|
|
|
|
# Tjek om der er modtaget besked
|
|
incoming = radio.receive()
|
|
if incoming:
|
|
display.scroll(incoming) |