35 lines
687 B
Python
35 lines
687 B
Python
|
#!/usr/bin/env python
|
||
|
|
||
|
import sk6812_multistrip as sk6812
|
||
|
import time
|
||
|
import math
|
||
|
|
||
|
s = sk6812.SK6812("192.168.42.1", 2703)
|
||
|
|
||
|
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)
|
||
|
|