- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpiotest.py
More file actions
Latest commit
29 lines (21 loc) · 448 Bytes
/
Copy pathgpiotest.py
File metadata and controls
29 lines (21 loc) · 448 Bytes
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
importRPi.GPIOasGPIO
importtime
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
clk=17
dt=18
list= [clk, dt]
foriinlist:
GPIO.setup(i, GPIO.IN, GPIO.PUD_DOWN)
clkLastState=GPIO.input(clk)
counter=0
running=True
try:
whilerunning:
clkState=GPIO.input(clk)
dtState=GPIO.input(dt)
time.sleep(0.001)
print("clk:", clkState, " dt:", dtState)
exceptKeyboardInterrupt:
GPIO.cleanup()
running=False