-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfade.py
40 lines (39 loc) · 964 Bytes
/
fade.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
import ArduinoCarPi
from time import sleep
ard = ArduinoCarPi.Arduino("/dev/ttyAMA0")
ard.registerLEDs(9,10,11)
currentR = 0
currentG = 0
currentB = 0
while True:
for c in range(0,3):
for i in range(0,250):
R = 0
G = 0
B = 0
if c == 0:
R = i
currentR = i
elif c == 1:
G = i
currentG = i
else:
B = i
currentB = i
ard.lightRGB(R,G,B)
sleep(0.05)
for i in range(250,0,-1):
R = 0
G = 0
B = 0
if c == 0:
R = i
currentR = i
elif c == 1:
G = i
currentG = i
else:
B = i
currentB = i
ard.lightRGB(R,G,B)
sleep(0.05)