Update main.py
parent
057a8c5f18
commit
78e94ad8e0
7
main.py
7
main.py
|
@ -19,14 +19,11 @@ led_power = True
|
|||
|
||||
try:
|
||||
with open('./idle.txt', 'r') as f:
|
||||
global idle_mode
|
||||
idle_mode = f.readline()
|
||||
except:
|
||||
with open('./idle.txt', 'w') as f:
|
||||
f.write('1')
|
||||
with open('./idle.txt', 'r') as f:
|
||||
global idle_mode
|
||||
idle_mode = f.readline()
|
||||
idle_mode = 1
|
||||
|
||||
def check_internet(url='http://www.google.com/', timeout=5):
|
||||
try:
|
||||
|
@ -92,7 +89,7 @@ if __name__ == '__main__':
|
|||
GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||
|
||||
GPIO.add_event_detect(13, GPIO.BOTH, callback=led_power_toggled(), bouncetime=300)
|
||||
GPIO.add_event_detect(13, GPIO.BOTH, callback=led_power_toggle(), bouncetime=300)
|
||||
GPIO.add_event_detect(19, GPIO.BOTH, callback=change_idle_mode(), bouncetime=300)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue