Official Raspberry Pi Pico Support Added to Arduino IDE

Arduino vs Pico
(Image credit: Tom's Hardware)

In a recent tweet from the official Arduino account, support for the Raspberry Pi Pico's RP2040 SoC has been officially added to the Arduino IDE. This is just a few weeks after a community project released its own package offering the Arduino IDE for RP2040 boards.

The Arduino IDE has seen great progress in recent years, with features such as a board manager and a library manager offering an easier means to add boards and install software to build projects via the Arduino IDE. The inclusion of Raspberry Pi's RP2040 chip is in anticipation of Arduino's own RP2040 board, the Arduino Nano RP2040 Connect, which should hopefully be arriving soon.

Installation is a breeze. Searching for "Pico" in the Boards Manager will show the official installation package. The Arduino IDE identifies RP2040-based boards as "Arduino Mbed OS RP2040," and all we need to do is connect our Raspberry Pi Pico and select the board from the Tools menu, then the port, and we can start writing code for our RP2040 board. We installed the package in the latest Arduino 1.8.13 IDE and the Arduino 2.0 IDE beta, and both worked with no faults.

So why is this a big deal? The official C/C++ workflow is well documented, and for those used to the process, it is exceptionally easy to use. MicroPython / CircuitPython is easy to use, and new users can quickly develop projects in a more "user-friendly" workflow. But what if we want the power of C/C++ but with an easier workflow? That is where the Arduino core comes to the fore. While not being a true C/C++ environment, rather it is a "dialect" of a subset of the standard library. The Arduino IDE offers the power and speed of those languages, but with a rich community of tutorials and content that can easily be ported to the RP2040.

Les Pounder

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • softeky
    I ported one of my "Community Project" Arduino IDE Raspberry Pico (RP2040) sketches to the Official (2.0 Beta), MacOSX-hosted Arduino IDE.

    It mostly worked, noting that varargs is treated differently within the two different ARM C compilers. "Community Project" implements VA_OPT(,) where "2.0 Beta" uses ##VA_ARGS (gcc cludge).

    In more detail: #if defined(RASPBERRY_PICO) /* printf macro messes up one-line if statements (with no section brackets) that use an else. */
    # define MAXMSGLINE 1000
    # if !defined(MACOSX)
    # define printf(format, ...) { char msg; sprintf(msg, format __VA_OPT__(,) __VA_ARGS__); Serial.print(msg); }
    # else /* !defined(MACOSX) */
    # define printf(format, ...) { char msg; sprintf(msg, format, ##__VA_ARGS__); Serial.print(msg); }
    # endif /* !defined(MACOSX) */
    #endif /* defined(RASPBERRY_PICO) */

    More importantly though (burying the lede), reading analog pin data using "analogRead()" in "2.0 Beta", by default, masks off the top two, most significant, bits (returning 10 bits instead of 12). It is necessary to call: analogReadResolution(12);to get sensible analog pin readings off the board.
    Reply