2019-12-01 14:21:01 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sk6812_multistrip as sk6812
|
|
|
|
import time
|
|
|
|
import math
|
2020-02-26 22:44:49 +01:00
|
|
|
import sys
|
2019-12-01 14:21:01 +01:00
|
|
|
|
2020-02-26 22:44:49 +01:00
|
|
|
s = sk6812.SK6812(sys.argv[1], 2703)
|
2019-12-01 14:21:01 +01:00
|
|
|
|
|
|
|
phase = 0
|
|
|
|
nled = 16
|
|
|
|
nstrip = 8
|
|
|
|
|
|
|
|
interval = 1.0/60
|
|
|
|
|
|
|
|
scale = 0.1
|
|
|
|
|
|
|
|
strip = 0
|
|
|
|
|
|
|
|
while True:
|
|
|
|
for i in range(nled):
|
|
|
|
x = 2*math.pi * i / nled
|
|
|
|
r = scale * (127 + 127 * math.sin(x + 8*phase + 0 * math.pi/2))
|
|
|
|
g = scale * (127 + 127 * math.sin(x + 4*phase + 1 * math.pi/2))
|
|
|
|
b = scale * (127 + 127 * math.sin(x + 2*phase + 2 * math.pi/2))
|
|
|
|
w = scale * (127 + 127 * math.sin(x + 1*phase + 3 * math.pi/2))
|
|
|
|
|
|
|
|
for strip in range(nstrip):
|
|
|
|
s.set_color(strip, i, r, g, b, w)
|
|
|
|
|
|
|
|
s.commit()
|
|
|
|
|
|
|
|
phase += 2*math.pi * interval / 10
|
|
|
|
time.sleep(interval)
|
|
|
|
|