Commit 331061c4 authored by Fjen Undso's avatar Fjen Undso
Browse files

lights: cleanup

parent 0a1fe1ac
__pycache__/*
......@@ -19,10 +19,12 @@ def send(data):
header = bytes([VERSION, SEQUENCE, 0, 0])
SOCKET.sendto(header + data, (UDP_IP, UDP_PORT))
SEQUENCE += 1
if SEQUENCE == 255:
SEQUENCE = 0
time.sleep(TIMEOUT)
def rgbw2bytes(pixel):
def pixel2bytes(pixel):
"""Convert rgbw color values to bytes. Limit values to range(0,255)."""
out = []
for color in pixel:
......@@ -43,18 +45,12 @@ def make_stripe_data(pixellist):
print("!!! Filling missing pixels")
missing_pixels = (LED_NUM - int(len(pixellist) / 4)) * 4
pixellist += missing_pixels * [0]
return rgbw2bytes(pixellist)
return pixel2bytes(pixellist)
colors = make_stripe_data([0, 255, 255, 0] * 24)
SEQUENCE=0
send(colors)
SEQUENCE=128
send(colors)
# while True:
# for i in range(LED_NUM):
# send(pixelsteps(i))
# for i in range(LED_NUM):
# send(pixelsteps(LED_NUM-1-i))
# fill_rainbow()
if __name__ == '__main__':
colors = make_stripe_data([0, 255, 255, 0] * 24)
SEQUENCE=0
send(colors)
SEQUENCE=128
send(colors)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment