Software saveboot using P14 on Pytrack/Pysense
-
Quite often (depending on my code ) I had problems uploading code, accessing the REPL or connecting to the board. I found myself a solution using the Button on Pytrack/Pysense when starting up the divice after a reset. Instead of the main.py an altenative main.py ( main_save.py in my case) will be loaded. Here is my boot.py code. Mybe someone find it useful:
from machine import Timer from machine import Pin from machine import main import pycom pycom.heartbeat(False) chrono = Timer.Chrono() chrono.start() i=True saveboot=False ##Timeout for pressing the button waitForSavebootTimeout=3 ###Waiting for the buttonn to be pressed: Green LED pycom.rgbled(0x005500) while i==True: if (Pin('P14').value()==0): saveboot=True lap = chrono.read() if lap>waitForSavebootTimeout or saveboot: i=False if saveboot: ###entering save boot main_save.py will be loaded: Blue LED pycom.rgbled(0x000055) main("main_save.py") if not saveboot: ###entering normal boot main.py will be loaded: Red LED pycom.rgbled(0x550000)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login