Add files via upload
This commit is contained in:
20
autoloader
Normal file
20
autoloader
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#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')
|
||||||
Reference in New Issue
Block a user