- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.py
More file actions
Latest commit
33 lines (24 loc) · 522 Bytes
/
Copy pathcontrol.py
File metadata and controls
33 lines (24 loc) · 522 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
29
30
31
32
33
importreadchar
importRPi.GPIOasGPIO
importtime
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT)
p=GPIO.PWM(18, 50)
p.start(7.5)
i=1
while1:
i+=1
key=readchar.readkey()
print(key)
ifkey=='q':
break
ifkey=='d':
try:
whileTrue:
p.ChangeDutyCycle(7.5) #90
time.sleep(1)
p.ChangeDutyCycle(12.5) #180
time.sleep(1)
exceptKeyboardInterrupt:
p.stop()
GPIO.cleanup()