Welcome to Pico Robot Car repository
2.3 Download code Startup automatically
2.3 Download code Startup automatically
1. Download the example code
Check the pin diagram of Pico 2/Pico and we know that the control pin of the onboard LED is GPIO25. Here we try to control the onboard LED.
Pico 2:
Pico:
After we successfully connected to Pico 2/Pico in the previous section, select Open -- This computer.
Open the Pico Robot supporting materials -> Appendix -> Course code -> 1. basic course -> 1.On board LED lamp.py.
Click the green Run button, the program starts running, and the Shell window will display %Run -c $EDITOR_CONTENT
At this time, the LED on the PICO board will continuously cycle on and off for one second. If you click the Stop button on the menu or unplug the data cable connected to the computer, the LED will stop flashing.
2. Startup
The above program must be connected to the computer to run. If you want to unplug the data cable to run, you must write the program file to PICO.
The provided routines can be set to start up by the following method.
- Continue to the previous step, in the opened 1.On board LED lamp.py file, select File - Save As.
- Select Raspberry Pi Pico.
- Enter main.py in File name. Note that it must be the file name of main.py to start, and then click Confirm.
- At this time, 1.On board LED lamp.py file becomes [main.py], where [ ] means that the file exists inside PICO.
At this time, press the reset button, or restart the Pico 2/Pico development board, and the LED on the board will flash automatically, without the need to run the program through a computer.
- Note that if Pico 2/Pico executes the startup program, the computer will prompt that the development version is running when the program is connected. The following steps need to be performed:
- After connecting the data cable, select Raspberry Pi Pico
- At this time, the development version is busy. According to the prompt, press Ctrl+C
- At this time, the main.py file is no longer executed, and the program can be run through thonny
- If you want to remove the startup program, after pressing Ctrl+C, click Open--Raspberry Pi Pico--right-click on the main.py file--Delete.
Note, if you cannot set it, please try a few more times, or re-flash the library file according to Section 2.1 to solve it.