Open graeme-winter opened 1 year ago
import time
import neopixel
import machine
pixels = neopixel.NeoPixel(machine.Pin(88, machine.Pin.OUT), 1)
def hsv2rgb(h, s, v):
h = h % 360
c = v * s
x = c * (1 - abs(((h/60.) % 2) - 1))
m = v - c
if 0 <= h < 60:
_r, _g, _b = c, x, 0
elif 60 <= h < 120:
_r, _g, _b = x, c, 0
elif 120 <= h < 180:
_r, _g, _b = 0, c, x
elif 180 <= h < 240:
_r, _g, _b = 0, x, c
elif 240 <= h < 300:
_r, _g, _b = x, 0, c
elif 300 <= h < 360:
_r, _g, _b = c, 0, x
return int((_r + m) * 0xff), int((_g + m) * 0xff), int((_b + m) * 0xff)
while True:
for j in range(360):
r, g, b = hsv2rgb(j, 1, 0.125)
pixels.fill((r, g, b))
pixels.write()
time.sleep(0.01)
Does what I would expect
also make this not the case (which is a bit more weird)