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

    How to stop program running on board

    Scheduled Pinned Locked Moved Pymakr
    replsync
    4 Posts 3 Posters 2.3k Views 3 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.
    • A Offline
      alg
      last edited by

      Hi,
      I'm sure there's a simple answer to this that I've missed, but what's the best way to interrupt a program on a pycom board, to allow REPL access using pymakr?

      Up until now I've been resetting the board, then quickly (within a second) clicking run then stop in pymakr - this usually worked. Now I've placed a 'try:' around my code though, with 'except: machine.reset()' and my old method doesn't seem to work anymore. I've got a suspicion I should have included something to allow keyboard interrupts?

      robert-hhR C 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @alg
        last edited by robert-hh

        @alg You can always perform as safeboot, which does nto execute boot.y and main.py on startup and brings you back into the REPL prompt. For doing that, you have to connect P12 (also called G20) to 3.3V and push reset. See also https://docs.pycom.io/chapter/toolsandfeatures/bootmodes.html. The documentation there is wrong, telling that previous versions of the firmware are executed. That is not the case and was only valid for the WiPy 1 device. But the boot script skipping part is right.

        1 Reply Last reply Reply Quote 1
        • C Offline
          crumble @alg
          last edited by

          @alg there will be many ways. You can exit your main loop under certain conditions.

          • You can use a free input pin to detect a certain state on which you break the loop
          • If your *Py acts as a server, you can stop when you receive a special message
          • At boot you detect if you are in your development WiFi and stop at the end of your loop.

          If you cannot set a pin for safeboot, you can use FTP to overwrite main.py and reboot the

          1 Reply Last reply Reply Quote 3
          • A Offline
            alg
            last edited by

            @robert-hh @crumble
            Thanks - problem solved.

            1 Reply Last reply Reply Quote 0

            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