Welcome to Raspberry Pi Pico 2 repository
2. Download a program
2. Download a program
Try to create a project and download the program.
Project Generator
If you don't want to configure the project manually, you can use the project configuration script to generate the project file.
You can go to this
https://github.com/raspberrypi/pico-project-generator
Use Git or directly package and download the file and unzip it,
Open Windows Terminal in the folder and run:
According to the previous pico-project-generator installation path, enter the folder, and then enter py -3 ./pico_project.py --gui
After starting the tool generator, select the project name, select the file path where the project is stored, select pico2 for Board Type, and select create VSCODE in the lower left corner project, and then click OK.
Click OK again.
After clicking the .C file, copy the code into it and save it
x#include "pico/stdlib.h"#define LED_PIN 25int main(){gpio_init(LED_PIN);gpio_set_dir(LED_PIN, GPIO_OUT);while (1){gpio_put(LED_PIN, 1);sleep_ms(1000);gpio_put(LED_PIN, 0);sleep_ms(1000);}}
After entering the bulid path of the project, delete all files in the folder
Enter the project path through the command line
Enter the following command to compile
xxxxxxxxxxcmake .. -G "NMake Makefiles"nmake
After the compilation is complete, files in formats such as .bin .hex .elf .uf2 can be generated in the build directory.
Drag the u2f in the above file into the disk recognized by Pico (Note: When burning for the first time, it is an empty code. Pico 2 can directly recognize the disk when connected to USB. When there is an executable program in it, you need to hold down the BOOTSEL button and then connect USB) After dragging, the disk is disconnected and execution begins (the blink compiled file used here has the onboard LED flashing)