By Muhammad Ibrahim · Published June 19, 2026 · Updated October 29, 2026 · 6 min read
How to Simulate the Arduino Blink Sketch, Including the LED Resistor Maths
Blink is the first sketch most people run, and it is a good first simulation because it tests three separate things at once: your wiring, your pin number and your code. This tutorial wires it with a correctly sized resistor, runs the sketch with Serial output so you can see every state change, and then breaks it on purpose in three ways so you can see how each mistake shows up.
- BOARD
- Arduino Uno
- PARTS
- 220 Ω resistor, red LED
- OUTPUT PIN
- D13
- BLINK
- 500 ms on, 500 ms off

Components needed for the Arduino Blink circuit
- An Arduino Uno
- One red LED
- One 220 Ω resistor
- No breadboard is needed. In LogicBench you can wire the parts directly to the Arduino pins
Open the circuit
Open the exact Blink circuit. Switch to Simulate and the sketch starts by itself, because the file already contains the verified sketch. Select the Arduino to see the sketch and the Serial Monitor in the Inspector.
How to simulate Arduino Blink step by step
Place the Arduino, resistor and LED
Add an Arduino Uno to the workspace and place a 220 Ω resistor and a red LED near its top header. The LED has a longer leg (anode, +) and a shorter leg (cathode, −). The cathode side must end up at ground.
Wire pin 13 through the resistor to the LED
Wire digital pin 13 to one end of the resistor and the other end of the resistor to the LED anode. Then wire the LED cathode to the GND pin on the same header, right next to pin 13. On a physical Uno pin 13 also drives the board's built-in L LED, which is why this is the traditional Blink pin.
Select the Arduino and read the sketch
Click the Arduino. The Inspector shows the Arduino Sketch panel, and a new Uno already contains the Blink sketch: int ledPin = 13; setup() sets the pin as an output and starts the Serial Monitor at 9600 baud; loop() switches the pin HIGH, waits 500 ms, switches it LOW and waits 500 ms again, printing LED ON and LED OFF each time.
Verify, then simulate
Click Verify. It compiles the sketch without running it, like the Verify button in the Arduino IDE, and the status changes to Compiled. Then press Simulate. The Arduino Sketch panel shows RUNNING, the LED blinks once a second and the Serial Monitor prints Arduino ready! once, followed by LED ON and LED OFF in turn. If you press Simulate before verifying, LogicBench asks you to Verify first.
Change the timing
Go back to Design, change both delay(500) values to delay(100) and click Verify again, then press Simulate. The LED now blinks five times per second. Simulate always runs the last verified version, so an edit has no effect until you Verify it.
Break it on purpose
Try each of these and note the result: (1) reverse the LED, (2) change the delays as above, (3) remove the resistor. With the LED reversed pin 13 still toggles and the Serial Monitor still prints, but the LED never lights. The second blinks faster. The third is the one to watch: an LED with no series resistor is exactly the mistake that destroys parts on a real bench, and LogicBench warns that pin 13 drives an LED directly without a resistor.
Arduino Blink wiring
| From | To | Why |
|---|---|---|
| Arduino D13 | Resistor, first end | D13 is an output that switches between 0 V and 5 V |
| Resistor, second end | LED anode (+) | The 220 Ω resistor limits the LED current to about 14 mA |
| LED cathode (−) | Arduino GND | Returns the current to ground |
What happens during one blink cycle
| Time | D13 | LED | Serial Monitor |
|---|---|---|---|
| 0 s | HIGH | On | Arduino ready! (once), then LED ON |
| 0.5 s | LOW | Off | LED OFF |
| 1.0 s | HIGH | On | LED ON |
| 1.5 s | LOW | Off | LED OFF |
The cycle then repeats forever, so the period is 1 s and the duty cycle is 50%.
How Blink works: the resistor, the pin limit and the sketch
Choosing the series resistor
Resistor = (V_supply − V_LED) / I_LED. A red LED drops about 2.0 V, so on a 5 V Uno pin with a 220 Ω resistor: I = (5 − 2.0) / 220 ≈ 13.6 mA. LogicBench solves the same circuit and gets about 14 mA. That is bright enough to see and below the 20 mA continuous guidance for most 5 mm LEDs. Other LED colours have different forward voltages (blue and white are around 3 V), which changes the current for the same resistor.
Why the pin limit matters
The ATmega328P on the Uno specifies an absolute maximum of 40 mA per I/O pin, and the total across all pins is limited as well. Staying around 10 to 20 mA per pin leaves margin. Without the resistor an LED is limited only by the pin's own drive capability and its own tiny resistance, so the current is far above both the LED's rating and the pin's, and something gets damaged.
What setup() and loop() actually do
pinMode(ledPin, OUTPUT) configures the pin as a driver. digitalWrite sets it to 5 V (HIGH) or 0 V (LOW). delay(500) waits for 500 ms. setup() runs once and loop() repeats forever, so this sketch has a 1-second period and a 50% duty cycle. Changing only one delay changes the duty cycle: delay(200) on and delay(800) off gives a short flash once a second.
Why you verify before you simulate
LogicBench follows the Arduino IDE here. Verify compiles the sketch and catches errors. Simulate then runs the last verified code. If you change the sketch and do not verify, the Compile status in the Arduino Sketch panel shows Modified and the simulation keeps running the old version. That is the usual reason for "I edited the delay and nothing changed".
Expected Arduino Blink output
- The LED is on for about 0.5 s and off for about 0.5 s, repeating once a second.
- The Serial Monitor shows Arduino ready! once, then LED ON and LED OFF alternating.
- Changing both delays to 100 makes it blink five times faster, and changing only the on-delay changes the duty cycle.
- Removing the series resistor produces a warning that pin 13 drives an LED without a series resistor, instead of a normal blink.
Arduino Blink not working? Common mistakes
The LED never lights
Check the polarity (anode towards pin 13, cathode to GND) and that the pin number in pinMode and digitalWrite matches the pin you wired. A reversed LED stays dark even though the Serial Monitor keeps printing.
Nothing runs when I press Simulate
Click Verify first. A sketch that has never been verified does not run, and LogicBench asks you to verify it.
I changed the sketch and nothing changed
Click Verify again after every edit. Simulate runs the last verified version, and the Compile status shows Modified until you do.
The sketch reports an error
Look for a missing semicolon, a missing closing brace, or a misspelled function name such as digitalwrite (the C++ names are case-sensitive).
The Serial Monitor is empty
Add Serial.begin(9600) to setup(). The Serial.println() lines are ignored until it has been called.
The LED is on all the time
Make sure the second digitalWrite sets the pin LOW and that both delay() calls are present. Without the LOW write the pin stays HIGH after the first iteration.
Frequently asked questions
How do I run Arduino code without any hardware?
Open LogicBench, place an Arduino Uno, wire your parts, select the board and type or paste the sketch in the Inspector. Click Verify to compile it, then press Simulate to run it. It is free and needs no account.
Which resistor should I use with an Arduino LED?
220 Ω is a good start for a red LED on a 5 V pin: (5 − 2.0) / 220 ≈ 13.6 mA. Anything from about 220 Ω to 1 kΩ works. A bigger resistor gives a dimmer LED and a smaller one a brighter LED that draws more current from the pin.
How do I change how fast the LED blinks?
Change the two delay() values. delay(100) in both places blinks five times per second. A short on-delay with a long off-delay, such as 200 and 800, gives a short flash once a second.
Why is the Serial Monitor empty?
The sketch must call Serial.begin(9600) in setup() before it prints. Without it the Serial.println() lines are ignored. Also check that the sketch is running, which the Arduino Sketch panel shows as RUNNING.
What happens if I connect the LED without a resistor?
A real LED on a pin with no resistor draws far more current than it is rated for and burns out, and it can damage the Arduino pin too. LogicBench catches it: it warns that the pin drives an LED directly without a series resistor and shows the burn.
Try it yourself
Open LogicBench and follow along — the simulator is free and needs no account.
Launch the simulator