diff --git a/main.py b/main.py index ff58a91..888512e 100644 --- a/main.py +++ b/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_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): now = datetime.now() @@ -31,12 +37,15 @@ def debug_print(message: str): def wheel(client, pos): 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) elif pos < 170: 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) else: 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) def rainbowCycle(client, strip, wait_ms=5, iterations=10):