21 lines
438 B
Python
21 lines
438 B
Python
#simpleloader.py
|
|
#waits 5 seconds for gpio12 to go low
|
|
#if it doesn't, loads autoload.py
|
|
#install it as main.py
|
|
import machine
|
|
import sys
|
|
import time
|
|
print('Press GPIO12 to exit to console in 5 secs')
|
|
flag=0
|
|
pin12=machine.Pin(12, machine.Pin.IN)
|
|
def console(x):
|
|
global flag
|
|
flag=1
|
|
pin12.irq(console, machine.Pin.IRQ_FALLING)
|
|
time.sleep(5)
|
|
if flag==0:
|
|
print('Loading autoload.py...')
|
|
|
|
else:
|
|
print('Exiting to console')
|