Sub topic 10
When nothing blinks: a checklist
This chapter assumes you have already uploaded a blink sketch at least once, that you know the roles of setup() and loop(), and that you can read a simple breadboard layout. You also need to know Ohm's law at an introductory level. The goal is a repeatable order of checks. It lets you find the fault in minutes instead of rewiring at random.
Why a systematic order matters
A blink that does not work has several independent places to fail. The failure can be in the toolchain (compile and upload), in the sketch logic, in the wiring, or in the components. If you change several things at once, you can no longer tell which change mattered.
The method is to split the system in half and test each half on its own. The board's built-in LED needs no wiring, so it tests the software path alone. The external LED then tests the wiring on top of that.
Step 1: Confirm the upload really happened
Many "my LED does not blink" reports are really "my sketch never reached the board". Read the output pane at the bottom of the IDE after you press Upload.
- A successful upload ends with a message such as "Done uploading" and a memory usage summary.
- A compile error stops before any upload. The old sketch stays on the board, so the board may keep running a previous program.
- An upload error means the compile worked but the transfer failed.
The last two cases look the same on the board: the LED does what it did before. Always check the output pane before you suspect the hardware.
Common upload errors
| Symptom in the output pane | Likely cause | Fix |
|---|---|---|
| `Port not found` or the port menu is greyed out | Charge-only USB cable, loose cable, or missing driver | Use a data cable. Try another USB port. Install the driver for your board's USB chip. |
| `avrdude: stk500_getsync(): not in sync` | Wrong board selected, wrong port, or something on pins 0 and 1 | Select the exact board model, reselect the port, and unplug anything from pins 0 and 1. |
| `Permission denied` on the port (Linux) | Your user cannot open the serial device | Add your user to the `dialout` group (on some distributions, `uucp`), then log out and back in. |
| `'LED_BUILTIN' was not declared` | A board package that does not define the constant | Use the board's actual pin number, or check that the right board is selected. |
| `expected ';' before '}' token` | Syntax error in the sketch | Go to the line the IDE highlights and look at the line above it. |
Cables and ports
Some USB cables carry power only. The board lights its power LED, which looks like a working connection, but no serial port appears. If the port list does not change when you plug the board in or unplug it, swap the cable first. This is the single most common cause of a missing port.
Each time you plug in the board, the operating system may assign a different port name, especially if you use a different USB socket. Reselect the port from the Tools menu whenever you change sockets.
Step 2: Test with the built-in LED
Before you look at the breadboard, upload the minimal sketch that uses the board's own LED.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}If the small LED on the board blinks once per second, the toolchain, the cable, the board, and the basic program all work. Any remaining fault is in your external circuit or in your changes to the sketch. If it does not blink, stay at this step. Wiring cannot be the cause because nothing is connected.
Things to check when the built-in LED stays dark:
- The board selection matches the physical board. A clone may need a different bootloader option, such as "ATmega328P (Old Bootloader)" on the Nano.
- The sketch really contains
pinMode(LED_BUILTIN, OUTPUT);insidesetup(). - You pressed the reset button, or re-plugged the board, and watched the LED for at least two seconds. A one-second blink is easy to miss if you look away.
- Another device or shield is not holding the pin. On many boards
LED_BUILTINis pin 13, which is also the SPI clock line.
Step 3: Check the sketch logic
Once the built-in LED works, compare your external-LED sketch against this known good version.
const uint8_t LED_PIN = 8;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}Typical logic faults:
- Missing
pinMode(). The pin stays an input. On AVR boards,digitalWrite(pin, HIGH)on an input pin enables the internal pull-up resistor instead of driving the pin. The LED may then glow very dimly, which is a strong sign of this mistake. - Pin number mismatch. The sketch says pin 8, but the wire goes to pin 9. Digital pin numbers on the board are labelled D8, D9, and so on. On some boards the number printed on the silkscreen differs from the processor's internal port name. Use the number printed on the board.
- Delay too short. With
delay(1)the LED toggles 500 times per second. It looks continuously on, at about half brightness. Use at least 100 ms to see a blink. - Missing
delay(). Without a delay the pin toggles at hundreds of kilohertz. The LED seems steadily dim, not blinking. - Both delays set the same way, or the LOW write removed. The LED stays on or off permanently. Read the
loop()body and check that both a HIGH and a LOW write exist. - Confused types. Storing a long interval in an
intoverflows at 32,767 on AVR boards. Useunsigned longfor times.
Step 4: Check the external circuit
If the built-in LED blinks and the sketch is correct, the fault is in the circuit. Disconnect the USB cable before you move wires. This protects the board from accidental short circuits while you work.
The circuit path
Current must travel in a complete loop: from the pin, through the resistor, through the LED from anode to cathode, and back to GND. A break anywhere in that loop stops the LED.
Check each element in turn.
- LED polarity. The long leg is the anode and goes toward the pin side. The short leg, next to the flat edge of the plastic case, is the cathode and goes toward GND. A reversed LED blocks current and stays dark. It is not normally damaged by the low reverse voltage here, so turning it around fixes it.
- Resistor in series. The resistor must sit in the same path as the LED. A resistor wired from the pin to GND, beside the LED, does not limit the LED current.
- Breadboard rows. The five holes in one numbered column, on one side of the centre gap, are connected. If the LED leg and the resistor end are in different columns, there is no connection. If both ends of a part sit in the same column, the part is shorted out.
- Power rails. On many breadboards the long rails along the edge are split in the middle. A GND wire that goes to the top half of the rail will not reach parts on the bottom half.
- Seating. Push the leads in fully. A part that is resting on top of the hole looks connected but makes no contact.
- GND connection. The return wire must go to a GND pin on the same board that runs the sketch. A missing return path is a very common mistake.
- Jumper wires. Wires can be broken inside the insulation. Replace a suspect wire with a different one.
Check the resistor value
Check that the resistor is neither too large nor too small. Use the series equation:
R = (Vsupply − Vforward) / I
For a 5 V board, a red LED with a forward voltage of about 2.0 V, and a target current of 15 mA:
R = (5 − 2.0) / 0.015 = 200 Ω
The next common value up is 220 Ω, which gives about 13.6 mA. A 3.3 V board with the same LED needs R = (3.3 − 2.0) / 0.015 ≈ 87 Ω, so 100 Ω is a sensible choice.
Two ways the value goes wrong:
- Too large. A 100 kΩ resistor passes only about 30 µA at 5 V. The LED may look completely dark. If you mistake a 10 kΩ resistor for 220 Ω, the LED glows faintly at best.
- Too small or missing. The LED draws far more than the pin can safely supply. The AVR limit is 40 mA absolute maximum per pin, and 20 mA is the recommended continuous value. An unprotected LED can burn out within seconds, and it can damage the pin too.
Read the colour bands with care. A 220 Ω resistor is red, red, brown. A 10 kΩ resistor is brown, black, orange. If you have a multimeter, set it to resistance and measure with the resistor out of the circuit.
Test the LED on its own
If you suspect the LED, take it out of the sketch's circuit and test it directly with the board's 5 V pin through the same resistor.
- Disconnect the wire from digital pin 8.
- Connect that resistor end to the 5 V (or 3.3 V) pin.
- If the LED lights, the LED, the resistor, and the GND path are good, and the fault lies in the pin or the sketch.
- If it stays dark, turn the LED around. If it is still dark, replace the LED.
Then move the wire back to pin 8. This separates a pin problem from a component problem in one move.
Measure instead of guessing
A multimeter finds the fault faster than visual inspection.
- Set it to DC volts and put the probes between pin 8 and GND while the sketch runs. You should see the voltage switch between about 0 V and the supply voltage (about 5 V). If it does, the sketch and pin are working and the fault is downstream.
- Measure across the resistor. About 3 V across it with a 5 V supply and a red LED means current is flowing.
- Measure across the LED. If it reads close to the full supply voltage and the LED is dark, the LED is open (broken) or reversed.
A meter slow to settle may only show an average. With a 500 ms interval it is fine; with a very fast toggle it is not.
Step 5: Look at less obvious causes
If all of the above is correct, consider the following.
- Power. A board powered from a weak USB port or a long thin cable may reset repeatedly. Watch for the built-in LED flashing in the pattern of a reboot, not at your set rate.
- Reset loops. A short circuit between 5 V and GND causes the board to restart or shut down. Remove the external parts and test the board alone.
- Pins with special roles. Pins 0 and 1 are the serial lines and are used by USB uploads. Avoid them for an LED. Pin 13 has the built-in LED and its resistor attached, which slightly changes the behaviour of an external LED on the same pin.
- Damaged pin. If an earlier mistake pushed too much current through a pin, it may no longer drive output. Move the circuit to another pin and change
LED_PINto match. - Wrong sketch uploaded. Open the sketch you think you uploaded and check the file name and the tab. It is easy to upload a sketch from a different window.
A short log of the process
Keep notes while you test. After each change, write down what you changed and what you observed. The note stops you from repeating the same step and helps another person help you. When you ask for help in a forum, include the board model, the IDE output text, the full sketch, and a clear photo of the wiring.
Summary of the checklist
- Read the IDE output pane. Did the upload succeed?
- Upload the stock blink sketch. Does the built-in LED blink?
- Compare your sketch against the known good version, especially the pin number and
pinMode(). - Unplug the board, then check LED polarity, resistor placement, breadboard columns, and the GND return.
- Check the resistor value by colour code or multimeter.
- Test the LED directly from the 5 V pin through the resistor.
- Measure the voltage at the pin while the sketch runs.
- Try a different pin, cable, and USB port.
Exercise
Your external LED on pin 8 stays dark. The built-in LED blinks correctly with the stock sketch. Your sketch is a copy of the known good version. You have unplugged the board. List, in order, the first four circuit checks you would make and what each one rules out.
Show answer
1) Check LED polarity: the long leg (anode) must face the resistor and pin, the short leg (cathode) must face GND. This rules out a reversed LED. 2) Check the breadboard columns: the resistor, LED, and wires must share columns correctly and not sit in the same column as each other's both ends. This rules out an open or shorted path. 3) Check the GND return wire goes to a GND pin on the board. This rules out a missing return path. 4) Check the resistor value by colour bands (220 Ω is red, red, brown). This rules out a resistor that is too large to let visible current through. After these, test the LED directly from the 5 V pin through the resistor to separate a component fault from a pin or sketch fault.
Exercise
A 5 V board drives a green LED with a forward voltage of about 2.2 V at a target current of 10 mA. Calculate the resistor value and pick a standard value. Then explain what you would see if you used a 47 kΩ resistor by mistake.
Show answer
R = (5 − 2.2) / 0.010 = 280 Ω. The next standard value up is 330 Ω, which gives about 8.5 mA. With a 47 kΩ resistor the current is about (5 − 2.2) / 47000 ≈ 60 µA, so the LED would be extremely dim or look dark, even though the circuit and the sketch are correct.
Exercise
The LED on pin 8 glows very dimly and does not blink, and the sketch has no pinMode() call. Why does it glow, and how do you fix it?
Show answer
Without pinMode(LED_PIN, OUTPUT), the pin stays an input. On AVR boards, digitalWrite(pin, HIGH) on an input enables the internal pull-up resistor, which supplies a tiny current that is enough for a faint glow but cannot switch the LED fully. Add pinMode(LED_PIN, OUTPUT); in setup().