Introduction
Welcome to the world of microcontrollers! The classic “Blink” example is the perfect starting point for any embedded systems journey. In this tutorial, we’ll use the Raspberry Pi Pico and its built-in LED on GPIO 25 to create a simple blinking pattern. The best part? You don’t need any hardware — we’ll run everything in the Velxio in-browser simulator, which provides SPICE-accurate analog simulation and a full-featured code editor.
By the end of this post, you’ll understand how to set up a basic circuit, write Arduino-compatible code, and simulate it live. Let’s dive in!
Circuit Walkthrough

The circuit is minimal — perfect for beginners. Here’s what we have:
- Raspberry Pi Pico (the microcontroller board)
- LED (green, but any color works)
- Resistor (220 Ω)
Wiring Details
- GPIO D2 on the Pico connects to the anode (A) of the LED via a green wire (
#00cc00). - The cathode (C) of the LED connects to one leg of the 220 Ω resistor via a grey wire (
#999999). - The other leg of the resistor connects to GND.1 on the Pico via a black wire (
#000000).
Note: The built-in LED on the Pico is connected to GPIO 25, but in this example we use an external LED on GPIO D2 to demonstrate wiring. You can easily modify the code to use the onboard LED by changing the pin to
LED_BUILTIN.
Component Values
| Component | Value / ID |
|---|---|
| LED | led-blink (green) |
| Resistor | r1 (220 Ω) |
| Pico pin | D2 (GPIO 2) |
| Pico GND | GND.1 |
Code Walkthrough
Here’s the complete Arduino sketch for the Pico:
// Raspberry Pi Pico — Blink LED
// Toggles the onboard LED on GPIO 25
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // GPIO 25
Serial.begin(115200);
Serial.println("Pico Blink Example");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("LED ON");
delay(500);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("LED OFF");
delay(500);
}
Code Breakdown
setup(): Runs once at startup. We setLED_BUILTIN(which is GPIO 25 on the Pico) as an output. We also initialize serial communication at 115200 baud and print a welcome message.loop(): Runs repeatedly. We turn the LED on (HIGH), print “LED ON”, wait 500 ms, turn the LED off (LOW), print “LED OFF”, and wait another 500 ms. This creates a 1-second blink cycle.
Important: The code uses
LED_BUILTINwhich is predefined for the Pico as GPIO 25. If you want to use the external LED on D2, changeLED_BUILTINto2.
Key Concepts for Students
- Digital Output:
pinMode()configures a pin as output;digitalWrite()sets it HIGH (3.3V) or LOW (0V). - Built-in LED: Many boards have an LED connected to a specific pin (GPIO 25 for Pico). Using
LED_BUILTINmakes code portable. - Serial Monitor:
Serial.println()sends data to the serial port, viewable in the simulator’s serial monitor. It’s invaluable for debugging. - Delay:
delay(ms)pauses the program. Be careful — it blocks other operations.
Common Pitfalls & Debugging Tips
- Wrong pin number: Double-check that the pin in code matches the wiring. If using the external LED, ensure it’s connected to D2 (GPIO 2).
- LED polarity: LEDs have an anode (long leg, positive) and cathode (short leg, negative). The circuit connects anode to D2 and cathode to resistor.
- Resistor value: A 220 Ω resistor limits current to safe levels. Too low a value may damage the LED or pin.
- Serial baud rate mismatch: Ensure the serial monitor is set to 115200 baud to see messages.
- Simulator controls: Use the compile button (checkmark) to build, then run (play button) to start simulation. The serial output appears in the console panel.


Suggested Extensions
Once you’ve mastered the basic blink, try these modifications:
- Change blink speed: Adjust the
delay()values to make it faster or slower. - Use the external LED: Modify the code to use pin
2instead ofLED_BUILTIN. - Add a button: Use a digital input to turn the LED on/off when pressed.
- Fade with PWM: Use
analogWrite()to create a breathing effect. - Multiple LEDs: Add more LEDs on different pins and create patterns.
Get Started with Velxio
Ready to build your own circuits? Velxio makes it easy to design, code, and simulate electronics projects right in your browser — no downloads or hardware required. The component picker lets you browse hundreds of parts.

Try the live example now: Pico Blink on Velxio
Happy blinking!