Go back

Blink an LED with Arduino: Your First Velxio Simulation

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 diagram of blink-led on the Velxio simulator canvas

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.

Velxio component picker modal browsing parts by category

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.

Source code for blink-led in the Velxio Monaco editor

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:

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 editor toolbar with compile and run controls

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.

Velxio canvas toolbar above the simulation viewport

Key Concepts for Students

Common Pitfalls and Debugging Tips

Suggested Extensions

Once you have the basic blink working, try these modifications:

  1. Change the blink rate: Modify the delay() values to make the LED blink faster or slower. Try 500 ms or 2000 ms.
  2. 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.
  3. Multiple LEDs: Add several LEDs to different pins and create a pattern, like a Knight Rider scanner.
  4. Fade with PWM: Use analogWrite() to fade the LED in and out. Note that only pins marked with ~ support PWM.
  5. 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!


Share this post on:
David Montero

Written by

David Montero

Creator of Velxio, the open-source circuit and Arduino simulator.

GitHub velxio.dev

Related posts


Previous Post
Build a Traffic Light Simulator with Arduino on Velxio