Programming Raspberry Pi Pico with Arduino IDE (Pico W Compatible)

Learn how to program the Raspberry Pi Pico and Pico W using the Arduino IDE. The Raspberry Pi Pico is a low-cost microcontroller board built around the RP2040 chip by the Raspberry Pi Foundation. In this guide, you’ll learn how to set up Arduino IDE and begin programming the Raspberry Pi Pico with C/C++.


Step 1: Adding the Raspberry Pi Pico to the Boards Manager

  1. Open Arduino IDE.

  2. Go to File > Preferences.

  3. In the "Additional Boards Manager URLs" field, enter the following URL:

    https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
  4. Click OK.

  5. Now, go to Tools > Board > Boards Manager…

  6. Search for "pico" and install the Raspberry Pi Pico/RP2040 boards package.

  7. Once installed, go to Tools > Board, and you'll see a selection of Raspberry Pi Pico boards.


Step 2: Selecting Your Pico Board

  1. Go to Tools > Board and select the Raspberry Pi Pico or Pico W model that you are using.


  1. Go to File > Examples > 1. Basic > Blink.

  2. The Blink sketch should load, which turns an LED on and off every second.

  3. You can also copy the code below:

    /*
      Blink - Turns an LED on for one second, then off for one second repeatedly.
      This example code is in the public domain.
    */
    
    // Setup function runs once when you press reset or power the board
    void setup() {
      pinMode(LED_BUILTIN, OUTPUT);  // Initialize digital pin LED_BUILTIN as an output
    }
    
    // Loop function runs repeatedly
    void loop() {
      digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED on
      delay(1000);                      // Wait for a second
      digitalWrite(LED_BUILTIN, LOW);   // Turn the LED off
      delay(1000);                      // Wait for a second
    }

Step 4: Connecting the Raspberry Pi Pico in BOOTLOADER Mode

  1. Put the Pico in Bootloader Mode:

    If your Raspberry Pi Pico is currently running MicroPython or is new, you need to manually put it into bootloader mode.

    • Press and hold the BOOTSEL button on the Pico while connecting it to your computer via USB.

    • A new mass storage device will appear on your computer. You can ignore this window and close it.

  2. Upload the Code:

    For future uploads using the Arduino IDE, the Pico board will automatically enter bootloader mode without pressing the BOOTSEL button.

  3. In Arduino IDE, open the Tools > Port menu, then select Select Other Board and Port....

  4. Select the Pico: Choose Raspberry Pi Pico or Raspberry Pi Pico W as the board, and select the appropriate COM port.

  5. Tick Show All Ports if the COM port doesn’t show up, and select UF2 Devices as the port option.


Step 5: Upload the Code

  1. After selecting the correct board and port, click on the Upload button in the Arduino IDE.

  2. Once the code is uploaded, you should receive a success message.


Step 6: Demonstration

  1. If everything went as expected, the onboard LED of the Raspberry Pi Pico should now be blinking every second.