-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hider.py
48 lines (39 loc) · 1.17 KB
/
Hider.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from microbit import *
import radio
CHANNEL_ICONS = {
1: Image.STICKFIGURE,
2: Image.HEART,
3: Image.GIRAFFE,
4: Image.HAPPY,
}
SEND_INTERVAL = 300
choosing_channel = True
channel = 1
display.show(CHANNEL_ICONS[channel])
while choosing_channel:
if button_a.was_pressed():
channel += 1
if channel == 5: channel = 1
display.show(CHANNEL_ICONS[channel])
if button_b.was_pressed():
choosing_channel = False
display.show(CHANNEL_ICONS[channel])
radio.config(group=channel, power = 6)
radio.on()
while True:
radio.send('hello')
received = None
while True:
received = radio.receive()
if not received:
break
if channel == 1 and received.lower() == 'santa':
display.scroll('Rudolph')
if channel == 2 and received.lower() == 'rudolph':
display.scroll('Snowman')
if channel == 3 and received.lower() == 'snowman':
display.scroll('Turkey')
if channel == 4 and received.lower() == 'turkey':
display.scroll('What falls in winter but never gets hurt?')
display.show(CHANNEL_ICONS[channel])
sleep(SEND_INTERVAL)