forked from Yannicked/cm-small-argb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnightrider.py
46 lines (31 loc) · 804 Bytes
/
nightrider.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
import pywinusb.hid as hid
import time
from cm import Led
def make_rgb(r, g, b):
return [r, g, b]
def create_static(r, g, b, num):
ret = []
for _ in range(num):
ret += make_rgb(r, g, b)
return ret
def main():
led = Led()
led.set_led_count(14)
led.set_mode(7)
try:
while True:
for i in range(14):
colors = [0]*14*3
colors[i*3] = 255
led.set_colors(colors)
time.sleep(0.05)
for i in reversed(range(1,13)):
colors = [0]*14*3
colors[i*3] = 255
led.set_colors(colors)
time.sleep(0.05)
except KeyboardInterrupt:
pass
#led.close()
if __name__ == '__main__':
main()