-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignal.py
More file actions
50 lines (39 loc) · 1.31 KB
/
signal.py
File metadata and controls
50 lines (39 loc) · 1.31 KB
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
49
50
from nanonav import BLE
def wait_for_signal(response):
signal = ''
while True:
response = ble.read() #somehow prevents bluetooth from disconnecting
#waiting for signal
if response == 10:
response = ble.read()
#feels nothing
elif response == 0:
ble.send(5) #go straight to execution ready
response = ble.read()
#feels breeze (hole)
elif response == 1:
signal = signal + 'B'
ble.send(10)
response = ble.read()
#feels stench (wumpus)
elif response == 2:
signal = signal + 'S'
ble.send(10)
response = ble.read()
#feels glitter (gold)
elif response == 3:
signal = signal + 'G'
ble.send(10)
response = ble.read()
#hears scream (wumpus killed)
elif response == 4:
signal = signal + 'D'
ble.send(10)
response = ble.read()
#all information received from coordinate, ready to execute next movement
elif response == 5:
return signal
else:
ble.send(10)
ble = BLE(name = 'Sprite1Robot')
response = ble.read()