sk6812-client/hsv_fade.py

43 lines
648 B
Python
Executable file

#!/usr/bin/env python
import sk6812_multistrip as sk6812
import time
import math
import sys
import random
from hsv2rgbw import hsv2rgbw
import numpy as np
sk = sk6812.SK6812(sys.argv[1], 2703)
sk.set_fadestep(10)
interval = 1/30
nled = 16
nstrip = 8
h = 0
s = 192
v = 255
loop = 0
while True:
v = (loop // 30) % 255
# update colors
for led in range(nled):
for strip in range(nstrip):
color = hsv2rgbw(h + 360 * strip//nstrip, s, v)
color = color * 50 // 100
sk.set_color(strip, led, color[0], color[1], color[2], color[3])
sk.commit()
loop += 1
time.sleep(interval)