using_the_pico_run_button
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| using_the_pico_run_button [2026/07/16 10:10] – walkeradmin | using_the_pico_run_button [2026/07/16 16:31] (current) – walkeradmin | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| \\ | \\ | ||
| - | The Raspberry Pi Pico has a RUN pin, see below. | + | The method to reset the Pico here is the same as in the previous simple version of the code. What has changed here is that we are using a more complex Micro Python program to show a better use case. |
| \\ | \\ | ||
| \\ | \\ | ||
| Line 13: | Line 13: | ||
| \\ | \\ | ||
| Connecting this Pin to GND starts (or if it is already running restarts) the Raspberry Pi Pico. For this example I am going connect a button from the RUN pin (30) to the GND Pin (28). | Connecting this Pin to GND starts (or if it is already running restarts) the Raspberry Pi Pico. For this example I am going connect a button from the RUN pin (30) to the GND Pin (28). | ||
| + | \\ | ||
| + | \\ | ||
| + | Connect the other button and LEDs as show below. | ||
| \\ | \\ | ||
| \\ | \\ | ||
| Line 27: | Line 30: | ||
| Download the following Micro Python code and save it to your Pico as <color # | Download the following Micro Python code and save it to your Pico as <color # | ||
| \\ | \\ | ||
| - | \\ | ||
| - | < | ||
| - | ==== The Code ==== | ||
| - | \\ | ||
| - | Below is the full code with all of the changes, there are two blocks that have been added. We will cover these in the next section below this code block. | ||
| \\ | \\ | ||
| < | < | ||
| Line 106: | Line 104: | ||
| \\ | \\ | ||
| ---- | ---- | ||
| - | </code> | + | ==== How it Works ==== |
| + | \\ | ||
| + | When you boot up the Pico, the file main.py you just created will run automatically. Pushing the lower button will stop (breakout) of the main.py. This is exactly how this was programmed, this is so that you can't get stuck in a software look with no way out. | ||
| + | \\ | ||
| + | \\ | ||
| + | However, once you push the breakout button, the only way to restart the main.py is to unplug the power, and plug it back in. That causes wear on the connected, and (the real reason is that) I am to lazy to keep doing this when testing a project. | ||
| + | \\ | ||
| + | \\ | ||
| + | If you now press the RUN button, the Pico will restart (you can restart the Pico with the RUN button even if it is not stopped). | ||
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
| + | ==== Running Example ==== | ||
| + | \\ | ||
| + | In the video below we can see the RUN button in operation. | ||
| + | \\ | ||
| + | \\ | ||
| + | {{ : | ||
| + | \\ | ||
| + | To start with the traffic light sequence is running, I then press the following buttons: | ||
| + | \\ | ||
| + | * 1. The breakout button. This stops the code (main.py). | ||
| + | * 2. The RUN button, this resets the Pico. | ||
| + | * 3. The breakout button. This stops the code again. | ||
| + | * 4. The RUN button, this resets the Pico. | ||
| + | |||
| + | This is a really nice way to start the Pico, or to restart the Pico, when you are doing a lot of testing, rather than plugging and unplugging cables all the time | ||
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
using_the_pico_run_button.1784196654.txt.gz · Last modified: by walkeradmin
