From f2b8ea7efa2a08c2f78ac35a6b88957248b06ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 9 Nov 2021 19:57:38 +0100 Subject: [PATCH] Update main.py --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 69f768a..3cf747e 100644 --- a/main.py +++ b/main.py @@ -15,6 +15,8 @@ LED_INVERT = False # True to invert the signal (when using NPN transistor LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53 global led_power +global led_power_toggler +led_power_toggler = True led_power = True try: @@ -85,9 +87,9 @@ def change_idle_mode(channel): def power_toggle(channel): if led_power == True: - return False + led_power_toggler = False else: - return True + led_power_toggler = True if __name__ == '__main__': strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL) @@ -100,6 +102,7 @@ if __name__ == '__main__': try: while True: + led_power = led_power_toggler try: with open('./idle.txt', 'r') as f: idle_mode = f.readline()