Sub topic 10
When nothing blinks: a checklist
Assume you know the basics of Arduino sketches, variables, voltage, current, and resistance. You also need an Arduino-compatible board, a USB cable, the Arduino IDE, an LED, a resistor, and a breadboard.
When an LED does not blink, test one part at a time. A fault can be in the program, the upload, the wiring, the LED direction, or the power path. Start with the simplest possible test.
Check the sketch first
Use the built-in LED before testing an external circuit. This removes breadboard wiring from the problem.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}Check these details:
- The sketch contains both
setup()andloop(). - Each statement ends with a semicolon.
- The pin is configured with
pinMode(..., OUTPUT). - The same pin is used by
pinMode()anddigitalWrite(). - The delay values are in milliseconds.
500means half a second. - The IDE reports that compilation and upload succeeded.
If the built-in LED blinks, the board and program are probably working. Move on to the external circuit.
Confirm the upload
The Arduino IDE must know which board and USB port to use.
- Select the board model in the board-selection menu.
- Select the port that appears when you connect the board.
- Upload the sketch.
- Wait for the upload to finish before disconnecting the cable.
A successful compile is not the same as a successful upload. Compilation checks the code on your computer. Uploading transfers the compiled program to the board.
If no port appears, try another USB cable. Some cables provide power but do not carry data. Also try another USB socket and check whether the board's power indicator turns on.
Inspect the external circuit
An LED is a polarized component, which means current should flow through it in one direction. The longer leg is usually the anode, or positive side. The shorter leg is usually the cathode, or negative side. The flat edge on many LED bodies marks the cathode.
The circuit should connect in this order:
- Arduino output pin
- Resistor
- LED anode
- LED cathode
- Arduino GND pin
The resistor and LED must be in series. A series connection gives current one path through both parts.
The resistor can be before or after the LED. The electrical result is the same, as long as the current flows from the output pin through the LED and returns to GND.
Check each breadboard connection physically. Components in the same breadboard row are connected internally, but the center gap separates the two sides. A wire that looks close may not share an electrical connection.
Check the pin number and resistor
If the program uses pin 8, the wire must leave physical pin 8. Do not confuse a digital pin number with the position of a breadboard hole.
The resistor must limit current. For example, with a 5 V supply, a red LED forward voltage of about 2 V, and a target current of 10 mA:
R = (5 V - 2 V) / 0.010 A = 300 Ω
A nearby standard value such as 330 Ω is suitable. A resistor that is too large may make the LED dim. Omitting the resistor can damage the LED or the board's output pin.
Use a diagnostic order
The following order prevents you from changing several things at once:
| Test | Expected result | What failure suggests |
|---|---|---|
| Built-in LED sketch | Built-in LED flashes | If it fails, check board selection and upload |
| Measure output pin | Pin changes between about 0 V and the board voltage | Wrong pin or sketch problem |
| Test LED direction | LED lights in only one direction | Reversed LED or damaged LED |
| Test ground connection | Circuit has a return path to GND | Missing or misplaced ground wire |
| Check resistor and rows | Current path is continuous | Breadboard or component placement fault |
A multimeter can measure voltage between the output pin and GND. During a slow blink, the reading should alternate between approximately 0 V and 5 V on a 5 V board, or between 0 V and 3.3 V on a 3.3 V board.
Avoid misleading timing tests
With delay(500), the LED changes state every half second. With a very short delay, the eye may see steady light instead of blinking. With no delay, the LED changes too quickly to observe.
Once the circuit works, replace blocking delays with millis() when other tasks must run at the same time. A blocked program cannot read a button or update another output during delay().
Exercise
The built-in LED blinks, but the external LED stays dark. The code uses pin 8, the external wire is on pin 7, and the LED is connected through a 330 Ω resistor. What should you check first?
Show answer
Move the wire to pin 8 or change the named pin in the sketch so the program and wiring use the same pin. Then check the LED's polarity and the GND connection.