crwdns360452:0crwdne360452:0
crwdns360454:0crwdne360454:0
crwdns360456:0crwdne360456:0
crwdns360458:0crwdne360458:0 crwdns360460:0crwdne360460:0
crwdns360466:0crwdne360466:0
crwdns360468:0crwdne360468:0
crwdns360470:0crwdne360470:0
- crwdns360472:0crwdne360472:0
- crwdns360474:0crwdne360474:0 crwdns360476:0crwdne360476:0 crwdns360478:0crwdne360478:0
- crwdns360480:0crwdne360480:0 crwdns360482:0crwdne360482:0
- crwdns360484:0crwdne360484:0 crwdns360486:0crwdne360486:0
- crwdns360488:0crwdne360488:0
- crwdns360490:0crwdne360490:0
- crwdns360492:0crwdne360492:0
crwdns360494:0crwdne360494:0
- crwdns360496:0crwdne360496:0
- crwdns360498:0crwdne360498:0
- crwdns360500:0crwdne360500:0
crwdns360502:0crwdne360502:0
1from microbit import *
2import radio
3radio.config(group=31)
4radio.on()
5
6while True:
7 message = radio.receive()
8 if message:
9 if message == 'angry':
10 display.show(Image.ANGRY)
11 audio.play(Sound.SOARING)
12 sleep(2000)
13 display.clear()
14 elif message == 'skull':
15 display.show(Image.SKULL)
16 audio.play(Sound.MYSTERIOUS)
17 sleep(2000)
18 display.clear()
19 elif message == 'ghost':
20 display.show(Image.GHOST)
21 audio.play(Sound.HELLO)
22 sleep(2000)
23 display.clear()
24
25 if button_a.was_pressed():
26 radio.send('angry')
27 display.show(Image.ANGRY)
28 sleep(2000)
29 display.clear()
30 elif button_b.was_pressed():
31 radio.send('skull')
32 display.show(Image.SKULL)
33 sleep(2000)
34 display.clear()
35 elif pin_logo.is_touched():
36 radio.send('ghost')
37 display.show(Image.GHOST)
38 sleep(2000)
39 display.clear()
crwdns360504:0crwdne360504:0 crwdns360506:0crwdne360506:0
crwdns360508:0crwdne360508:0
- crwdns360510:0crwdne360510:0
- crwdns360512:0crwdne360512:0
- crwdns360514:0crwdne360514:0
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.