-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontroller.py
49 lines (45 loc) · 1.06 KB
/
controller.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
49
import pyfirmata
comport='COM3'
board=pyfirmata.Arduino(comport)
led_1=board.get_pin('d:13:o')
led_2=board.get_pin('d:12:o')
led_3=board.get_pin('d:11:o')
led_4=board.get_pin('d:10:o')
led_5=board.get_pin('d:9:o')
def led(total):
if total==0:
led_1.write(0)
led_2.write(0)
led_3.write(0)
led_4.write(0)
led_5.write(0)
elif total==1:
led_1.write(1)
led_2.write(0)
led_3.write(0)
led_4.write(0)
led_5.write(0)
elif total==2:
led_1.write(1)
led_2.write(1)
led_3.write(0)
led_4.write(0)
led_5.write(0)
elif total==3:
led_1.write(1)
led_2.write(1)
led_3.write(1)
led_4.write(0)
led_5.write(0)
elif total==4:
led_1.write(1)
led_2.write(1)
led_3.write(1)
led_4.write(1)
led_5.write(0)
elif total==5:
led_1.write(1)
led_2.write(1)
led_3.write(1)
led_4.write(1)
led_5.write(1)