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()