-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathledLine.py
More file actions
33 lines (31 loc) · 858 Bytes
/
ledLine.py
File metadata and controls
33 lines (31 loc) · 858 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
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(26,GPIO.OUT)
pwmoutR = GPIO.PWM(13,100)
pwmoutB = GPIO.PWM(12,100)
pwmoutG = GPIO.PWM(26,100)
pwmoutR.start(0)
pwmoutG.start(0)
pwmoutB.start(0)
try:
while True:
#pwmoutR.ChangeDutyCycle(100)
#pwmoutG.ChangeDutyCycle(100)
#pwmoutB.ChangeDutyCycle(100)
for duteCycle in range(0,100,1):
pwmoutB.ChangeDutyCycle(duteCycle)
pwmoutG.ChangeDutyCycle(100-duteCycle)
time.sleep(0.1)
for duteCycle in range(100,0,-1):
pwmoutB.ChangeDutyCycle(duteCycle)
pwmoutG.ChangeDutyCycle(100-duteCycle)
time.sleep(0.1)
except KeyboardInterrupt:
pwmoutR.stop()
pwmoutG.stop()
pwmoutB.stop()
GPIO.cleanup()
print('exeting')