Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1246

Python • MicroPython/RPi Pico sys.exit()

$
0
0
Hello All
Newbie question:
Running a Pico with MicroPython (Thonny on my PC). I wrote three programs. I am running two sets of servos, each with different timings. The third program "calls" the first two and starts them through a momentary switch. At the end of the sequence, I've used the sys.exit() command to stop the program (I don't want it to loop). While connected to the PC and in Thonny, the program works beautifully. All servos move as they should, and it does MPY: soft reboot at the end. All well and good. I am very happy with it.

As I am running four servos, I am powering the servos through an external power source, and this works well also

So, what's the problem? I want the Pico to run from the same power source as the servos, so when I switch on the power, the program runs, then shuts down at the end (just like it does while running from Thonny on the PC) Problem is that when I unplug the program cable to the PC, then use the VSYS to power the Pico, it starts the program, and it runs fine, but it does not stop at the end, it loops. I don't understand why it does not loop while running from Thonny, but it does loop while running from VSYS

Statistics: Posted by Iceman1007 — Sun Jan 19, 2025 5:01 pm



Viewing all articles
Browse latest Browse all 1246

Trending Articles