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

MicroPython • Re: Is regular Pi Pico bricking normal?

$
0
0
Micropython is usually programmed with thonny or VScode using a plugin.
c/cpp is usually programmed with SDK or arduino.

For micropython:
Usually the RUN pin (aka reset) can be pulled low with a button to reset the Pico. Which allows thonny or VScode to connect.
Sometimes a micropython application, started by main.py, runs into a state again which does not respond to external stimulus from thonny.

In my projects, I use a spare GPIO pin to terminate the code immediately after being started.

Code:

import machineimport sysled = machine.Pin("LED", machine.Pin.OUT)pin = machine.Pin(16, machine.Pin.IN, machine.Pin.PULL_UP)if pin.value() == 0:    led.on()    print("pin 16 low, do not start")    sys.exit(1)# other code

Statistics: Posted by ghp — Sat Jan 11, 2025 7:49 pm



Viewing all articles
Browse latest Browse all 4952

Trending Articles