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.
I don’t think it can be currently, but in Arduino’s blog post 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.
Thanks, Shoe, I look forward with interest.
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
Breaking News. Arduino support on the Pico:
See here: (14) Arduino Support for the Pi Pico available! And how fast is the Pico? - YouTube
This really works!
earlephilhower (Earle F. Philhower, III) (github.com)
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.
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
**************************************************************************/
#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.”);
}
Can you format this, please?