-
Notifications
You must be signed in to change notification settings - Fork 15
/
knobtest.py
46 lines (34 loc) · 904 Bytes
/
knobtest.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
from gpiozero import *
switch1 = Button(17)
switch2 = Button(27)
switch3 = Button(22)
switch4 = Button(5)
switch5 = Button(6)
switch6 = Button(13)
switch7 = Button(19)
switch8 = Button(25)
switch9 = Button(24)
switch10 = Button(23)
while True:
if switch1.is_pressed:
print("switch 1 is selected")
elif switch2.is_pressed:
print("switch 2 is selected")
elif switch3.is_pressed:
print("switch 3 is selected")
elif switch4.is_pressed:
print("switch 4 is selected")
elif switch5.is_pressed:
print("switch 5 is selected")
elif switch6.is_pressed:
print("switch 6 is selected")
elif switch7.is_pressed:
print("switch 7 is selected")
elif switch8.is_pressed:
print("switch 8 is selected")
elif switch9.is_pressed:
print("switch 9 is selected")
elif switch10.is_pressed:
print("switch 10 is selected")
else:
print("some other state")