37 lines
600 B
Python
Executable file
37 lines
600 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sk6812
|
|
import time
|
|
import random
|
|
|
|
s = sk6812.SK6812("zybot", 2703)
|
|
s.set_fadestep(10)
|
|
|
|
colorcycle = [
|
|
(255, 0, 0, 0),
|
|
(0, 255, 0, 0),
|
|
(0, 0, 255, 0),
|
|
(0, 0, 0, 255),
|
|
(255, 0, 0, 255),
|
|
(0, 255, 0, 255),
|
|
(0, 0, 255, 255),
|
|
(255, 255, 255, 255),
|
|
]
|
|
|
|
k = 0
|
|
|
|
while True:
|
|
r = colorcycle[k][0]
|
|
g = colorcycle[k][1]
|
|
b = colorcycle[k][2]
|
|
w = colorcycle[k][3]
|
|
|
|
for i in range(300):
|
|
s.fade_color(i, r, g, b, w)
|
|
s.commit()
|
|
time.sleep(0.01)
|
|
|
|
k = (k + 1) % len(colorcycle)
|
|
time.sleep(1)
|
|
|