Skip to content
Discussion options

You must be logged in to vote

@karfas put me onto trying to isolate the problem, so I took Thonny out of the equation. I set BOOT and MAIN to run autonomously, from a power cycle, through reset and soft_reset by passing the next reset type in a file.

{I had to replace indent spaces with '.' for readability}

#BOOT
import machine
with open("reset.txt","r") as f:
....r=f.read()
c = machine.reset_cause()
with open("test.txt","a") as f:
....f.write("\n[boot] Started. Reset cause "+str(c)+" from last reset of "+r)

and

#MAIN
import machine
with open("reset.txt","r") as f:
....r=f.read()
with open("test.txt","a") as f:
....f.write("\n[main] Started. Last reset "+r)
if r == "power":
....n="reset"
elif r== "reset":
....n="soft"

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@DS256
Comment options

@karfas
Comment options

@DS256
Comment options

Comment options

You must be logged in to vote
3 replies
@scruss
Comment options

@DS256
Comment options

@davehylands
Comment options

Answer selected by DS256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants