Raspberry Pi Documentation

The C/C++ SDK

SDK Setup

For a full walk-through of how to get going with the C/C++ SDK, you should read our 'getting started' documentation. However, if you are intending to develop for Pico on a Raspberry Pi, then you can set up the C/C++ toolchain quickly by running our setup script from the command line.

Note
You should make sure the OS on your Raspberry Pi is up to date before running the setup script.

Raspberry Pi Pico C/C++ SDK

Our official C SDK can be used from the command line, or from popular integrated development environments like Visual Studio Code, Eclipse, and CLion. To get started, download our C/C++ SDK and Examples, and take a look at our 'getting started' documentation to get going. Or for a quick setup see the next section.

You can find documentation around the C/C++ SDK at;

Getting started with Raspberry Pi Pico

C/C++ development with Raspberry Pi Pico and other RP2040-based microcontroller boards

Connecting to the Internet with Raspberry Pi Pico W

Getting Raspberry Pi Pico W online with C/C++ or MicroPython

Raspberry Pi Pico C/C++ SDK

Libraries and tools for C/C++ development on RP2040 microcontrollers

The API level Doxygen documentation for the Raspberry Pi Pico C/C++ SDK is also available as a micro-site.

Note

If you are building applications with the C/C++ SDK and targeting boards other than the Raspberry Pi Pico, you will need to pass -DPICO_BOARD=boardname to CMake. Here boardname is the name of your board, e.g. for the Adafruit Feather RP2040 you should pass -DPICO_BOARD=adafruit_feather_rp2040. See the boards/ directory in the Raspberry Pi Pico SDK, and the forums, for more information.

Note

If you are building applications with the C/C++ SDK for Raspberry Pi Pico W and, to connect to a network you will need to pass -DPICO_BOARD=pico_w -DWIFI_SSID="Your Network" -DWIFI_PASSWORD="Your Password" to CMake.

Your First Binaries

The first program anyone writes when using a new microcontroller is to blink an LED on and off. The Raspberry Pi Pico comes with a single LED on-board. The LED is connected to GP25 on the board’s Raspberry Pi RP2040 for Pico, and WL_GPIO0 on the Infineon 43439 wireless chip for Pico W.

Blink an LED 640x360 v2

You can blink this on and off by,

  1. Download the Blink UF2 for Raspberry Pi Pico, or for Pico W.

  2. Push and hold the BOOTSEL button and plug your Pico into the USB port of your Raspberry Pi or other computer.

  3. It will mount as a Mass Storage Device called RPI-RP2.

  4. Drag and drop the Blink UF2 binary onto the RPI-RP2 volume. Pico will reboot.

You should see the on-board LED blinking.

You can see the code on Github for the Raspberry Pi Pico and Pico W versions.

Say "Hello World"

The next program anyone writes is to say 'Hello World' over a USB serial connection.

Hello World 640x360 v2

  1. Download the 'Hello World' UF2.

  2. Push and hold the BOOTSEL button and plug your Pico into the USB port of your Raspberry Pi or other computer.

  3. It will mount as a Mass Storage Device called RPI-RP2.

  4. Drag and drop the 'Hello World' UF2 binary onto the RPI-RP2 volume. Pico will reboot.

  5. Open a Terminal window and type:

    sudo apt install minicom
    minicom -b 115200 -o -D /dev/ttyACM0

You should see 'Hello, world!' printed to the Terminal.

You can see the code on Github