Search code examples
micropythonraspberry-pi-pico

How do I stop a script on a Raspberry Pi Pico?


On a Raspberry Pi Pico I ran a looping script that blinks the onboard LED. It loops forever.

I can’t reset it, stopping the power doesn’t work because it runs on startup and Thonny doesn’t even recognize the Raspberry Pi Pico isn't connected anymore. I used a breadboard to create a reset button but it isn’t doing anything.

I'd put the code here, but I don't have it. I actually did this a year or two ago, but I couldn't get the Pico to work again, so I gave up and just threw it in a cupboard and abandoned it. The code was probably something like:

from machine import Pin, Timer
led = Pin(25, Pin.OUT)
timer = Timer()

def blink(timer):
    led.toggle()

timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

I just found this online as how to get the Pico to blink, but clearly I must have done something wrong because I can't get it to stop. Help!


Solution

  • Step 1 Nuke your pico:

    check out: https://github.com/polhenarejos/pico-nuke

    Step 2 Replace your main.py with some other/new script

    Step 3 Go do something fun with your pico