Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 1: VS Code and Blink | Digi-Key Electronics
YouTube Viewers YouTube Viewers
152K subscribers
145,274 views
0

 Published On May 10, 2021

Previously, we covered how to program the Raspberry Pi Pico using MicroPython. In this tutorial, we will show you how to create a simple blink program using C. We will also configure VS Code so that it can build projects with the push of a button.

Note that the written version of this tutorial can be found here: https://www.digikey.com/en/maker/proj...

You will need to install the build tools for the RP2040. I recommend following Chapter 1 (for Linux) or Chapter 9 (for macOS and Windows) of the official Getting Started with Raspberry Pi Pico guide (https://datasheets.raspberrypi.org/pi.... Alternatively, if you are on Windows and do not wish to install Build Tools for Visual Studio, you can follow the guide here: https://shawnhymel.com/2096/how-to-se....

In VS Code, you will want to install the CMake and CMake Tools extensions. These tools will provide buttons on your status bar that allow you to build your project by clicking a button. All of your projects will need a unique CMakeLists.txt file, which tells the cmake tool how to generate the build files.

CMake is a build system generator and does not actually build the program. The Raspberry Pi Pico SDK uses “make” as the actual build system. We can call cmake and make in the command line to build the project, or we can click on the CMake and Build buttons in VS Code to accomplish the same thing.

To upload the compiled program, we put the Pico into bootloader mode by pressing and holding the BOOTSEL button when plugging in the USB cable. This will cause the Pico to enumerate as a USB drive on the computer. Then, copy the compiled .uf2 file to that drive. The Pico will reset and automatically start running the program.

Product Links:
https://www.digikey.com/en/products/d...

Related Videos:
Intro to MicroPython – Maker.io Tutorial -    • Intro to MicroPython – Maker.io Tutor...  
Intro to Raspberry Pi Pico and RP2040:
Part 1: VS Code and Blink -    • Intro to Raspberry Pi Pico and RP2040...  
Part 2: Debug with Picoprobe -    • Intro to Raspberry Pi Pico and RP2040...  
Part 3: How to Use PIO -    • Intro to Raspberry Pi Pico and RP2040...  

Related Project Links:
https://www.digikey.com/en/maker/proj...

Related Articles:
Introduction to MicroPython - https://www.digikey.com/en/maker/blog...
Raspberry Pi Pico and RP2040 - MicroPython Part 1 - https://www.digikey.com/en/maker/proj...

Learn more:
Maker.io - https://www.digikey.com/en/maker
Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with Digi-Key on Facebook   / digikey.electronics  
And follow us on Twitter   / digikey  

show more

Share/Embed