For an index to all my stories click this text
If there is something the Raspberry Pico lacks it is a reset button.
Sometimes your program goes berserk and you need a means to stop it. Pulling the plug is one way. Having a reset button is another. But the Pico has none. So lets add it.
Two ways to reset
There are two ways to reset your Pico and I am going to show both.
Above you can see a setup with two buttons and a led. The led is connected to the power rails with a current delimiting resistor and it is ON as long there is power on the power rails.
The button on the left is connected to GND and to pin 37 on the Pico which is the 3V3 EN pin.
The button on the right is connected to GND and to pin 30 on the Pico which is the RUN pin.
Now lets enter the next Python program:
import utime
while True:
print('running')
utime.sleep(1)
Cal it main.py and save it to your Pico.
Run the program and press the button on the right side.
The program will stop and you can edit it. However the led stays on.
Run the program again and now press the button on the left.
The program will stop and the led goes OFF for as long as you press the button.
So there we have it. Two ways to reset the Pico.
Even a program that runs as main stops and we can edit it.
The difference is that by using the button on the left the power is cut and your sensors will get reset too. The Raspberry Pi foundation mentions that this is not recommended and might harm your Pico. I have been using this extensively the last weeks and did not encounter any problem. Be warned anyway.
Which one to use depends on various factors and on which sensors you are using. So choose the one that is best for your project.
Till next time
Have fun
Luc Volders