From 9b6ccda60210c29e274a0acf620db5a804a7cd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 2 Jul 2022 10:28:24 +0200 Subject: [PATCH] added animation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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):