Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Software saveboot using P14 on Pytrack/Pysense

    Scheduled Pinned Locked Moved Projects
    boot.pysafeboothangspytrackpysense
    1 Posts 1 Posters 387 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tvetter1976
      last edited by

      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)  
      
      
      1 Reply Last reply Reply Quote 2

      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
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom