# Raspberry Pi Pico and Arduino IDE?

**URL:** <https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941>\
**Category:** Support\
**Created:** [January 21, 2021, 10:36am UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941 "2021-01-21T10:36:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaspPieman](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@RaspPieman](https://forums.pimoroni.com/u/RaspPieman)\
**Post date:** [January 21, 2021, 10:36am UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/1 "2021-01-21T10:36:02Z")

</div>

I am very interested in the newly released Raspberry Pi Pico using the RP2040 chip. Can anyone tell me if it can be programmed using the Arduino IDE, like most of my other microprocessors. I really don’t want to install a different tool chain.

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [January 21, 2021, 10:45am UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/2 "2021-01-21T10:45:47Z")

</div>

I don’t think it can be currently, but in [Arduino’s blog post](https://blog.arduino.cc/2021/01/20/welcome-raspberry-pi-to-the-world-of-microcontrollers/) they say that they’re in the process of porting t

> But there’s more! We are going to port the Arduino core to this new architecture in order to enable everyone to use the RP2040 chip with the Arduino ecosystem (IDE, command line tool, and thousands of libraries). Although the RP2040 chip is fresh from the plant, our team is already working on the porting effort… stay tuned.

---

<div class="post-metadata">

**Author:** ![RaspPieman](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@RaspPieman](https://forums.pimoroni.com/u/RaspPieman)\
**Post date:** [January 21, 2021, 12:21pm UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/3 "2021-01-21T12:21:02Z")

</div>

Thanks, Shoe, I look forward with interest.

---

<div class="post-metadata">

**Author:** ![pschatzmann](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@pschatzmann](https://forums.pimoroni.com/u/pschatzmann)\
**Post date:** [January 31, 2021, 11:28am UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/4 "2021-01-31T11:28:18Z")

</div>

I am also badly missing this and could not wait…

In one and a half days of work I came up with the following: [A simple Arduino Framework for the new Raspberry Pico - Phil Schatzmann](https://www.pschatzmann.ch/home/2021/01/31/a-simple-arduino-framework-for-the-new-raspberry-pico/)

---

<div class="post-metadata">

**Author:** ![Tonygo2](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/tonygo2/32/7814_2.png) [@Tonygo2](https://forums.pimoroni.com/u/Tonygo2)\
**Post date:** [March 26, 2021, 3:25pm UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/5 "2021-03-26T15:25:01Z")

</div>

Breaking News. Arduino support on the Pico:

See here: [(14) Arduino Support for the Pi Pico available! And how fast is the Pico? - YouTube](https://www.youtube.com/watch?v=-XHh17cuH5E)

---

<div class="post-metadata">

**Author:** ![Tonygo2](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/tonygo2/32/7814_2.png) [@Tonygo2](https://forums.pimoroni.com/u/Tonygo2)\
**Post date:** [April 3, 2021, 10:56am UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/6 "2021-04-03T10:56:59Z")

</div>

This really works!  
[earlephilhower (Earle F. Philhower, III) (github.com)](https://github.com/earlephilhower)

Easy to setup and run Blink. Digital and analog IO work a treat. It compiles quite quickly and automatically uploads to the Pico.

```
/*
  Analog read a pot and control LED brightness with pot value
  Tony Goodhew 3 April 2021
  10K pot on pin 26
  LED and 330 Ohm resistor on pin 16
  
*/
//Initializing LED Pin
int led_pin = 16;

void setup() {
  Serial.begin(11520);
  delay(1000); // Wait for Serial port
  //Declaring LED pin as output
  pinMode(led_pin, OUTPUT);
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(26); // Range is 0 - 4095
  sensorValue = sensorValue - 26;
  // Correct ADC zero value offset - Top less important
  if (sensorValue < 0) {sensorValue = 0;}
  // print out the value you read:
  Serial.println(sensorValue);
  int pwmValue = int(sensorValue / 16); // Range 0 - 255
  analogWrite(led_pin, pwmValue);
  delay(200);
}

```

Tried to get SSD1306 working with Adafruit libraries. It compiled and uploaded the example but screen did not light up. I’m not sure where to plug in SDA and SCL. I’ve tried 0,1 and 8,9 but Arduino IDE expects them to be predefined to specified pins.

---

<div class="post-metadata">

**Author:** ![Hmitch](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@Hmitch](https://forums.pimoroni.com/u/Hmitch)\
**Post date:** [September 30, 2021, 3:30pm UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/7 "2021-09-30T15:30:44Z")

</div>

YES YOU CANProcessing: Program the Pico Explorer with Arduino IDE.docx…  
In the Arduino IDE go to Tools \>board\>board manager  
Search for Raspberry Pi PICO, install ”Raspberry Pi PICO/RP2040” by Earle F. Philhouser

Select board \>Raspberry Pi RP2040 boards\>Raspberry Pi Pico  
Next plug PICO into USB while holding BOOT Button down , release after 2 seconds  
Next go to FILE\>Examples\>01.Basics\>Blink which will load blink script  
Hit Upload arrow it will install Blink, system LED will start to blink  
After first Upload a port will be assigned  
For all next programs you want to Upload you will have to select a port from Tools\>Port  
From now on the PICO can be treated as an Arduino board with an assigned port  
To get the screen working on the “pico explorer” you must install two library files  
“Adafruit\_GFX” and “Adafruit ST7735 and ST7789 Library”  
Go to File\>Examples\>Adafruit ST7735 and ST7789 Library\>graphictest  
Change values to  
#define TFT\_CS 17  
#define TFT\_RST -1 // Or set to -1 and connect to Arduino RESET pin  
#define TFT\_DC 16  
#define TFT\_MOSI 19 // Data out  
#define TFT\_SCLK 18 // Clock out  
// OPTION 1 (recommended) is to use the HARDWARE SPI  
// OPTION 1 (recommended) is to use the HARDWARE SPI // For 1.14", 1.3", 1.54", 1.69", and 2.0" TFT with ST7789:  
Adafruit\_ST7789 tft = Adafruit\_ST7789(TFT\_CS, TFT\_DC, TFT\_RST);

// OPTION 2 lets you interface the display using ANY TWO or THREE PINS,  
// OR for the ST7789-based displays, we will use this call  
//Adafruit\_ST7789 tft = Adafruit\_ST7789(TFT\_CS, TFT\_DC, TFT\_MOSI, TFT\_SCLK, TFT\_RST);

void setup(void) {  
Serial.begin(9600);

// Use this initializer if using a 1.54" 240x240 TFT:  
tft.init(240, 240); // Init ST7789 240x240

// SPI speed defaults to SPI\_DEFAULT\_FREQ defined in the library  
// Note that speed allowable depends on chip and quality of wiring  
// may end up with a black screen some times, or all the time.  
tft.setSPISpeed(40000000);  
YOUR BOARD WILL NOW WORK Just program it like other Arduino boards with a display screen  
I will answer any questions about this use of the PICO

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
This is a library for several Adafruit displays based on ST77\* drivers.  
The 1.54" TFT breakout  
----\> [Adafruit 1.54 240x240 Wide Angle TFT LCD Display with MicroSD [ST7789] : ID 3787 : $24.95 : Adafruit Industries, Unique & fun DIY electronics and kits](https://www.adafruit.com/product/3787)  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

#include \<Adafruit\_GFX.h\> // Core graphics library  
#include \<Adafruit\_ST7789.h\> // Hardware-specific library for ST7789  
#include \<SPI.h\>

// For the breakout board, you can use any 2 or 3 pins.  
// These pins will also work for the 1.8" TFT shield.  
#define TFT\_CS 17  
#define TFT\_RST -1 // Or set to -1 and connect to Arduino RESET pin  
#define TFT\_DC 16  
#define TFT\_MOSI 19 // Data out  
#define TFT\_SCLK 18 // Clock out

// OPTION 1 (recommended) is to use the HARDWARE SPI  
// For 1.14", 1.3", 1.54", 1.69", and 2.0" TFT with ST7789:  
Adafruit\_ST7789 tft = Adafruit\_ST7789(TFT\_CS, TFT\_DC, TFT\_RST);

// OR for the ST7789-based displays, we will use this call  
//Adafruit\_ST7789 tft = Adafruit\_ST7789(TFT\_CS, TFT\_DC, TFT\_MOSI, TFT\_SCLK, TFT\_RST);

float p = 3.1415926;

void setup(void) {  
Serial.begin(9600);

// Use this initializer if using a 1.54" 240x240 TFT:  
tft.init(240, 240); // Init ST7789 240x240

// SPI speed defaults to SPI\_DEFAULT\_FREQ defined in the library  
// Note that speed allowable depends on chip and quality of wiring  
// may end up with a black screen some times, or all the time.  
tft.setSPISpeed(40000000);

uint16\_t time = millis();  
tft.fillScreen(ST77XX\_BLACK);  
time = millis() - time;  
tft.setTextSize(3);  
tft.print(time, DEC);  
delay(5000);

// tft print function!  
tftPrintTest();  
delay(4000);

// a single pixel  
tft.drawPixel(tft.width()/2, tft.height()/2, ST77XX\_GREEN);  
delay(5000);

// tft.fillScreen(ST77XX\_BLACK);

Serial.println(“done”);  
delay(1000);  
}

void loop() {  
tft.invertDisplay(true);  
delay(500);  
tft.invertDisplay(false);  
delay(500);  
}

void testdrawtext(char \*text, uint16\_t color) {  
tft.setCursor(0, 0);  
tft.setTextColor(color);  
tft.setTextWrap(true);  
tft.print(text);  
}

void tftPrintTest() {  
tft.setTextWrap(false);  
tft.fillScreen(ST77XX\_BLACK);  
tft.setCursor(0, 30);  
tft.setTextColor(ST77XX\_RED);  
tft.setTextSize(1);  
tft.println(“Hello World!”);  
tft.setTextColor(ST77XX\_YELLOW);  
tft.setTextSize(2);  
tft.println(“Hello World!”);  
tft.setTextColor(ST77XX\_GREEN);  
tft.setTextSize(3);  
tft.println(“Hello World!”);  
tft.setTextColor(ST77XX\_BLUE);  
tft.setTextSize(4);  
tft.print(1234.567);  
delay(1500);  
tft.setCursor(0, 0);  
tft.fillScreen(ST77XX\_BLACK);  
tft.setTextColor(ST77XX\_WHITE);  
tft.setTextSize(3);  
tft.println(“Hello World!”);  
tft.setTextSize(3);  
tft.setTextColor(ST77XX\_GREEN);  
tft.print(p, 4);  
tft.println(" Pi?");  
tft.println(" “);  
tft.print(8675309, HEX); // print 8,675,309 out in HEX!  
tft.println(” HEX!");  
tft.println(" ");  
tft.setTextColor(ST77XX\_WHITE);  
tft.println("Sketch ");  
tft.println(“Runtime”);  
tft.println(“for: “);  
tft.setTextColor(ST77XX\_MAGENTA);  
tft.print(millis() / 1000);  
tft.setTextColor(ST77XX\_WHITE);  
tft.print(” Seconds.”);  
}

---

<div class="post-metadata">

**Author:** ![Tonygo2](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/tonygo2/32/7814_2.png) [@Tonygo2](https://forums.pimoroni.com/u/Tonygo2)\
**Post date:** [October 1, 2021, 4:34pm UTC](https://forums.pimoroni.com/t/raspberry-pi-pico-and-arduino-ide/15941/8 "2021-10-01T16:34:06Z")

</div>

Can you format this, please?
