4DVolt

Arduino simulator: sequential LEDs step by step

Published on Nov 4, 2026

Illustration: Arduino simulator: sequential LEDs step by step

Testing an Arduino project without building anything on the bench is possible: in the 4DVolt simulator you open a ready example, compile the code and watch the LEDs blink on screen, on the breadboard and in 3D. That way you make mistakes, fix them and learn without burning components or wasting time on loose wires.

The problem: testing before building

Beginners with Arduino usually find the mistake only after wiring everything: a reversed LED, the wrong pin, code that does not do what was expected. With a simulator, the circuit and code are tested first, and physical assembly is left for what already works.

Step by step: sequential LEDs

The example uses an Arduino Uno with three LEDs (green on pin D8, yellow on D9 and red on D10) that light one at a time, about half a second each. It is the same script as the video above.

Loading the simulator…
Press play: the Arduino runs the program and lights green (D8), yellow (D9) and red (D10), one at a time. Click an LED or a resistor to see its values.

1. Open the example

In the File menu, choose Examples and click Sequential LEDs. The project opens with the components and connections already in place.

2. Compile and run the code

Open the Code panel and click Compile and run. The code is compiled and the Arduino starts running it. If there are errors, the panel shows the number of errors and the line of each one.

3. See the assembly on the breadboard

Switch to the Breadboard (2D) view. With the board empty, the system warns you and offers the Assemble automatically button, which places the parts and connects the jumpers according to the schematic. The check against the schematic shows whether anything is missing.

4. Press play

Start the simulation with the play button. The LEDs blink in sequence, following the code you compiled. Change the timings in the code, compile again and see the change right away.

How the code works

The program has two parts, like every Arduino sketch. setup() runs once and configures the LED pins as outputs with pinMode. loop() repeats forever: it lights an LED with digitalWrite(pin, HIGH), waits with delay(500), turns it off with LOW and moves to the next.

void setup() {
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}

void loop() {
  digitalWrite(8, HIGH);
  delay(500);
  digitalWrite(8, LOW);
  // the same for pins 9 and 10
}

The snippet above shows the principle; the simulator example's code follows the same structure.

Ideas to modify the example

  • Change the delay time and watch the sequence get faster or slower.
  • Reverse the order of the LEDs so the sequence goes back and forth.
  • Add a fourth LED on another pin and include it in the code.
  • Use a for loop to step through the pins without repeating lines.

Try the Arduino simulator for free

Create your free account: open this example, change the code and build your own circuits. See also 4DVolt's electronic design feature.

Next example: how to light an LED with a button, with digital input reading. If you have trouble reading the schematic, see the electronic component symbols.

Read also

Questions and answers No questions yet

You need to be logged in to take part. Log in or Create free account