Update main.py
parent
f0f4782055
commit
f2b8ea7efa
7
main.py
7
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
|
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
|
||||||
|
|
||||||
global led_power
|
global led_power
|
||||||
|
global led_power_toggler
|
||||||
|
led_power_toggler = True
|
||||||
led_power = True
|
led_power = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -85,9 +87,9 @@ def change_idle_mode(channel):
|
||||||
|
|
||||||
def power_toggle(channel):
|
def power_toggle(channel):
|
||||||
if led_power == True:
|
if led_power == True:
|
||||||
return False
|
led_power_toggler = False
|
||||||
else:
|
else:
|
||||||
return True
|
led_power_toggler = True
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
|
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:
|
try:
|
||||||
while True:
|
while True:
|
||||||
|
led_power = led_power_toggler
|
||||||
try:
|
try:
|
||||||
with open('./idle.txt', 'r') as f:
|
with open('./idle.txt', 'r') as f:
|
||||||
idle_mode = f.readline()
|
idle_mode = f.readline()
|
||||||
|
|
Loading…
Reference in New Issue