parent
a75b2e15d9
commit
9b6ccda602
9
main.py
9
main.py
|
@ -23,6 +23,12 @@ LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
|
||||||
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
|
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
|
||||||
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
|
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
|
||||||
|
|
||||||
|
global animation_r
|
||||||
|
animation_r = 255
|
||||||
|
global animation_g
|
||||||
|
animation_g = 0
|
||||||
|
global animation_b
|
||||||
|
animation_b = 0
|
||||||
|
|
||||||
def debug_print(message: str):
|
def debug_print(message: str):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
@ -31,12 +37,15 @@ def debug_print(message: str):
|
||||||
|
|
||||||
def wheel(client, pos):
|
def wheel(client, pos):
|
||||||
if pos < 85:
|
if pos < 85:
|
||||||
|
client.publish("server-rack-led/rgb", str(pos * 3)+","+str(255 - pos * 3)+","+str(0))
|
||||||
return Color(pos * 3, 255 - pos * 3, 0)
|
return Color(pos * 3, 255 - pos * 3, 0)
|
||||||
elif pos < 170:
|
elif pos < 170:
|
||||||
pos -= 85
|
pos -= 85
|
||||||
|
client.publish("server-rack-led/rgb", str(255 - pos * 3)+","+str(0)+","+str(pos * 3))
|
||||||
return Color(255 - pos * 3, 0, pos * 3)
|
return Color(255 - pos * 3, 0, pos * 3)
|
||||||
else:
|
else:
|
||||||
pos -= 170
|
pos -= 170
|
||||||
|
client.publish("server-rack-led/rgb", str(0)+","+str(pos * 3)+","+str(255 - pos * 3))
|
||||||
return Color(0, pos * 3, 255 - pos * 3)
|
return Color(0, pos * 3, 255 - pos * 3)
|
||||||
|
|
||||||
def rainbowCycle(client, strip, wait_ms=5, iterations=10):
|
def rainbowCycle(client, strip, wait_ms=5, iterations=10):
|
||||||
|
|
Loading…
Reference in New Issue