Introduction
Welcome to the world of embedded electronics! The first program most people write when learning Arduino is the Blink sketch. It’s the “Hello, World!” of microcontrollers—a simple way to verify that your board, code, and circuit are all working together. In this tutorial, we’ll build and simulate the classic Blink LED circuit entirely in your browser using Velxio, the in-browser circuit and microcontroller simulator with SPICE-accurate analog support. No hardware required!

Circuit Walkthrough
Our circuit is minimal: we only need an Arduino Uno board and its built-in LED. The Arduino Uno has a small LED connected to digital pin 13, with a current-limiting resistor already on the board. That means we don’t need any external components—just the board itself.
In Velxio, you can place an Arduino Uno from the component picker. Click the Components button in the canvas toolbar to open the component picker modal, then search for “Arduino Uno” and drag it onto the canvas.

Once placed, the Arduino Uno appears on the canvas. The built-in LED is labeled “L” near pin 13. No wiring is needed because the LED is already connected internally. However, if you wanted to use an external LED, you would connect its anode (long leg) to pin 13 through a 220Ω resistor, and its cathode (short leg) to GND.
Code Walkthrough
Now let’s look at the code that makes the LED blink. Open the code editor by clicking the Code button in the editor toolbar.

The code is written in Arduino C++ and consists of two required functions: setup() and loop().
// Blink LED Example
// Toggles the built-in LED on pin 13
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Let’s break it down:
pinMode(13, OUTPUT);– Insetup(), we configure digital pin 13 as an output. This tells the Arduino that we want to send signals out from that pin, not read signals in.digitalWrite(13, HIGH);– Sets pin 13 to 5 volts (HIGH), which turns the LED on.delay(1000);– Pauses the program for 1000 milliseconds (1 second).digitalWrite(13, LOW);– Sets pin 13 to 0 volts (LOW), turning the LED off.delay(1000);– Another 1-second pause.- The
loop()function repeats forever, so the LED blinks on and off continuously.
Try It Live
You don’t even need to leave this page — the exact circuit from this tutorial is embedded below. Press Run simulation and watch the LED blink:
Running the Simulation
To run the simulation, click the Run button in the editor toolbar.

Velxio will compile the code and start the simulation. You should see the built-in LED on the Arduino canvas blink on and off every second. You can also use the canvas toolbar to pause, stop, or reset the simulation.

Key Concepts for Students
- Digital Output Pins: Arduino pins can be configured as inputs or outputs. When set as OUTPUT, you can write HIGH (5V) or LOW (0V) to control external devices like LEDs.
pinMode(): Always set the pin mode insetup(). Forgetting this can lead to unexpected behavior.digitalWrite(): Sends a digital signal (HIGH or LOW) to a pin.delay(): Halts program execution for a given number of milliseconds. Useful for timing, but blocks other operations.- Built-in LED: Most Arduino boards have an LED connected to pin 13 with a series resistor, making it easy to test without extra components.
Common Pitfalls and Debugging Tips
- Wrong pin number: Make sure you’re using the correct pin number. The built-in LED is on pin 13, but if you use an external LED, double-check the wiring.
- Missing
pinMode(): If you forget to set the pin as OUTPUT, the LED may not light up. Always includepinMode(pin, OUTPUT);insetup(). - LED polarity: If using an external LED, the anode (long leg) must go to the positive side (through a resistor) and the cathode (short leg) to ground. Reversing them won’t damage the LED, but it won’t light.
- No resistor: An LED without a current-limiting resistor can draw too much current and damage the pin or the LED. The built-in LED already has a resistor, but external LEDs need one (typically 220Ω to 1kΩ).
- Simulation not running: Ensure you clicked the Run button. If the simulation is paused, click Run again.
Suggested Extensions
Once you have the basic blink working, try these modifications:
- Change the blink rate: Modify the
delay()values to make the LED blink faster or slower. Try 500 ms or 2000 ms. - Use an external LED: Add an external LED with a resistor to pin 13 and ground. Modify the code to use a different pin, e.g., pin 12.
- Multiple LEDs: Add several LEDs to different pins and create a pattern, like a Knight Rider scanner.
- Fade with PWM: Use
analogWrite()to fade the LED in and out. Note that only pins marked with~support PWM. - Button control: Add a push button to turn the LED on only when pressed. You’ll need to read a digital input with
digitalRead().
Call to Action
Ready to try it yourself? Open the live example in Velxio and start blinking: Blink LED on Velxio. No downloads, no setup—just your browser and a passion for electronics. Happy blinking!