The Raspberry Pi Pico is a powerhouse microcontroller board powered by Raspberry Pi's custom-designed RP2040 dual-core ARM Cortex-M0+ silicon chip running at 125 MHz. This online workbench lets you write C++/Arduino code, wire circuits, and simulate RP2040 hardware directly in your web browser with zero hardware required.
1. Getting to Know Your Raspberry Pi Pico (RP2040)
The RP2040 brings 32-bit dual-core high-speed computing to hobbyists and engineers. Operating at 3.3V logic, it offers 26 multi-function GPIO pins, dedicated hardware PWM slices, and high-precision 12-bit analog input channels.
Dual-Core ARM Cortex-M0+ @ 125MHz
Two 32-bit ARM cores run concurrently at 125 MHz with 264KB on-chip SRAM. You can execute independent code routines on Core 0 and Core 1 simultaneously using setup1() and loop1().
26 Multi-Function 3.3V GPIO Pins
GPIO pins GP0 through GP22 and GP26-GP28 operate at strict 3.3V logic levels. Pin GP25 controls the high-efficiency on-board green status LED.
3x 12-Bit ADC Channels (GP26, GP27, GP28)
High-resolution 12-bit analog converters (0 to 4095) provide 4x finer sensitivity than traditional 8-bit Arduino boards for precision sensor readings.
Hardware PWM, I2C, SPI & UART
Featuring 16 independent PWM channels, 2x I2C controllers, 2x high-speed SPI buses, and 2x UART serial controllers with flexible pin multiplexing.
2. RP2040 Coding 101: The Core Building Blocks
RP2040 Arduino code builds upon the standard setup() and loop() structure with enhanced 32-bit multi-threading capabilities:
void setup() / void loop()
Core 0 execution pipeline. Prepares peripheral pins, initializes UART Serial communication at 115200 baud, and runs the primary control loop.
void setup1() / void loop1()
Core 1 independent execution pipeline. Run intensive mathematical operations, display refreshes, or real-time sensor polling without blocking Core 0!
3. Hands-on Step-by-Step Projects
Project 1: Dual-Core Concurrent LED Sequencer
Demonstrate true 32-bit multi-processing: Core 0 blinks the onboard LED on GP25 while Core 1 blinks an external LED on GP15 at a completely different rate.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
void setup1() {
pinMode(15, OUTPUT);
}
void loop1() {
digitalWrite(15, HIGH);
delay(150);
digitalWrite(15, LOW);
delay(150);
}
Project 2: High-Resolution 12-Bit Analog Dimmer
Read analog voltage from a potentiometer on ADC0 (GP26) with 4096-step precision and smoothly drive hardware PWM on GP16.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const int potPin = 26;
const int pwmPin = 16;
void setup() {
analogReadResolution(12);
pinMode(pwmPin, OUTPUT);
Serial.begin(115200);
}
void loop() {
int raw = analogRead(potPin);
int pwmVal = map(raw, 0, 4095, 0, 255);
analogWrite(pwmPin, pwmVal);
Serial.print("Raw ADC: ");
Serial.print(raw);
Serial.print(" -> PWM: ");
Serial.println(pwmVal);
delay(50);
}
4. Top Beginner Mistakes on RP2040
1. 3.3V Logic Level Limits (Never Feed 5V to GPIOs!)
Unlike 5V Arduino Uno boards, RP2040 pins are NOT 5V tolerant. Connecting a 5V sensor directly to RP2040 GPIO pins will permanently damage the silicon. Always use 3.3V sensors or logic level shifters.
2. Serial Baud Rate Configuration
The RP2040 standard Serial port communicates at 115200 baud by default. Ensure your Serial.begin(115200) matches the Terminal baud rate.
5. Accelerated Coding with AI Assistant (Ctrl + K)
Generate circuits, write custom PIO state machines, and diagnose compiler warnings in real time using our built-in AI assistant. Press Ctrl + K anywhere in the workspace to get instant help.