Why Start With Blink?
Blinking an LED looks trivial, but it is the most useful first project you can build, because it proves your entire development chain in one go. When the LED flashes, you know the Arduino IDE is installed, the USB driver works, the cable carries data, the board is selected correctly, the bootloader accepts code, and a pin can drive real current. Every later problem you meet, from a sensor that returns nothing to a display that stays blank, becomes easier to debug because you already know the basics are sound.
In this guide you will wire an external LED to an Arduino Uno R3, work out the right resistor value instead of guessing, upload and understand a Blink sketch, and then take two steps beyond the standard tutorial: blinking without delay() and fading the LED with PWM. Those two techniques show up in almost every real project.
You do not need any previous electronics experience. If you can plug in a USB cable and follow a numbered list, you can finish this in about half an hour.
Meet the Arduino Uno R3
The Uno R3 is built around the ATmega328P, an 8-bit AVR microcontroller. It is the board that most books, courses and forum answers assume you own, so learning it well pays off even if you later move to an ESP32 or STM32.
| Feature | Uno R3 value |
|---|---|
| Microcontroller | ATmega328P, 8-bit AVR |
| Clock speed | 16 MHz |
| Flash memory | 32 KB (about 0.5 KB used by the bootloader) |
| SRAM | 2 KB, for variables while the program runs |
| EEPROM | 1 KB, survives power loss |
| Digital I/O | 14 pins, six of them PWM (3, 5, 6, 9, 10, 11) |
| Analog inputs | 6 pins (A0 to A5), 10-bit ADC |
| Communication | 1 UART, SPI and I2C |
| Logic level | 5 V |
The 5 V logic is a real convenience: most hobby sensors and modules rated for 5 V connect directly with no level shifting. The board is powered either from USB or from the barrel jack, and the on-board regulator produces the 5 V and 3.3 V rails.
A genuine Uno uses a second chip, the ATmega16U2, as its USB-to-serial bridge. Many low-cost clones use a CH340 chip instead. They behave identically once the driver is installed, but a clone with a CH340 usually needs a separate driver on Windows and older macOS versions, and it appears as a different port name.
Board Layout: The Key Areas
Before plugging anything in, find these parts on the board:
- Digital pins 0 to 13 run along the top edge. Pins 0 (RX) and 1 (TX) are shared with the USB serial connection, so avoid using them for other purposes while uploading or using
Serial. - Analog pins A0 to A5 sit on the bottom-right edge. They can also work as ordinary digital pins when you run short.
- The power header on the bottom-left carries 3.3 V, 5 V, two GND pins, VIN (the raw input voltage) and RESET.
- ICSP headers are the two 2×3 pin clusters that expose SPI and in-circuit programming. Beginners rarely need them.
- The built-in LED is marked L and is wired to digital pin 13 through its own resistor. The stock Blink example uses this LED, which is why you can test a brand-new board with no extra parts.
💡 Tip
The 3.3 V pin on the Uno can supply only about 50 mA, because it comes from a small on-board regulator. A 3.3 V module that draws more makes the voltage sag and the board unstable. For hungry 3.3 V parts, use a separate regulator fed from the 5 V rail.
Power and Pin Limits You Should Know
Three numbers prevent most beginner damage:
- Per-pin current: a digital pin is rated for 20 mA recommended and 40 mA absolute maximum. Treat 20 mA as your design limit.
- Total pin current: all I/O pins together should stay under about 200 mA.
- USB power: a computer's USB port provides up to 500 mA, which covers the board plus a few LEDs and sensors but not motors or large LED strips.
For the barrel jack (2.1 mm, centre-positive), the recommended input is 7 to 12 V. The board accepts a wider range, but anything above 12 V makes the regulator run hot, and below 7 V the 5 V rail may not hold up under load. The board automatically prefers external power over USB when both are connected.
Installing the Arduino IDE and Testing the Board
Download Arduino IDE 2 from arduino.cc/en/software. It is free, runs on Windows, macOS and Linux, and bundles the AVR compiler, so no separate toolchain is needed. Then:
- Plug the Uno into a USB port.
- Choose Tools → Board → Arduino AVR Boards → Arduino Uno.
- Choose Tools → Port and select the entry that appeared when you plugged the board in. It is a COM port on Windows, and something like
/dev/cu.usbmodemXXXXon macOS or/dev/ttyACM0on Linux. Clone boards with a CH340 chip show up as/dev/ttyUSB0or/dev/cu.wchusbserial.... On Linux, if the upload fails with "permission denied", add your user to thedialoutgroup withsudo usermod -a -G dialout $USER, then log out and back in. - Open File → Examples → 01.Basics → Blink and click Upload.
If the small L LED next to pin 13 turns on for a second and off for a second, over and over, your IDE, driver, cable and board all work. Do not move on until this works, because every later step depends on it.
Components
6 itemsNeed these parts? Get this build sheet by email
Parts list with buy links, plus new builds as they're published. By subscribing you agree to our Privacy Policy. Unsubscribe anytime.
Why Does the LED Need a Resistor?
A bare LED has almost no resistance of its own once it starts conducting. Connect it straight between a 5 V pin and ground and it draws far more current than it can handle. Within moments the LED burns out, and the pin driver inside the ATmega can be damaged too. The resistor limits the current to a safe value.
The calculation is Ohm's law applied to the voltage left over after the LED takes its share. A standard red LED drops about 2.0 V when lit, and the Uno pin outputs 5 V:
R = (V_supply - V_led) / I
R = (5.0 - 2.0) / 0.020 = 150 Ω (for 20 mA)A 220 Ω resistor, the value used here, gives roughly 14 mA. The LED is a little dimmer than at 20 mA, but it is still clearly bright and the pin has a comfortable safety margin. Different LED colours drop different voltages, so the best resistor changes slightly:
| LED colour | Typical forward voltage | Resistor for about 15 mA |
|---|---|---|
| Red | about 2.0 V | 220 Ω |
| Yellow / green | about 2.1 to 2.2 V | 180 to 220 Ω |
| Blue / white | about 3.0 to 3.3 V | 100 to 120 Ω |
These are typical figures and vary between manufacturers, so check the datasheet if you are using a particular part. The resistor can sit on either side of the LED, because it only needs to be somewhere in the series path. To spot a 220 Ω resistor, look for the colour bands red, red, brown, followed by a gold tolerance band.
Wiring the Circuit
Identify the LED's polarity first. The longer leg is the anode (+) and the shorter leg is the cathode (−). The cathode side also has a flat edge on the plastic rim. LEDs only work one way round, so a backwards LED simply stays dark, which is normally harmless at 5 V.
- Place the LED in the breadboard so its two legs sit in different rows.
- Connect the anode through the 220 Ω resistor, one end of the resistor in the anode's row and the other in a free row, to digital pin 9 with a jumper wire.
- Connect the cathode to a GND pin on the Uno with the second jumper wire.
That is the whole circuit: one LED, one resistor, two wires. We use pin 9 rather than 13 deliberately, because pin 9 supports PWM, which we will use shortly to fade the LED.
Remember that a breadboard connects the five holes in each short row, but the two sides of the centre gap are separate. The LED and the resistor are meant to share exactly one row, the anode row, because that is where they connect. But if both legs of the same part land in the same row, that part is shorted out and does nothing, so check that the LED's two legs, and the resistor's two ends, are always in different rows.
The Blink Sketch
Every Arduino program has two required functions. setup() runs once at power-up or reset, and loop() runs over and over forever. This sketch configures pin 9 as an output in setup(), then in loop() it switches the pin HIGH and LOW with a pause between each change.
// Arduino Uno R3 - external LED blink
// LED anode -> 220 ohm resistor -> pin 9, cathode -> GND
#define LED_PIN 9 // pin connected to the LED circuit
#define ON_MS 500 // LED on time (milliseconds)
#define OFF_MS 500 // LED off time (milliseconds)
void setup() {
pinMode(LED_PIN, OUTPUT); // make the pin an output
Serial.begin(9600); // optional: for the Serial Monitor
Serial.println("Blink sketch started");
}
void loop() {
digitalWrite(LED_PIN, HIGH); // pin to 5 V, LED lights
Serial.println("LED ON");
delay(ON_MS);
digitalWrite(LED_PIN, LOW); // pin to 0 V, LED off
Serial.println("LED OFF");
delay(OFF_MS);
}What Each Line Does
#define LED_PIN 9gives the pin a name. Changing it in one place updates the whole sketch, and readers seeLED_PINinstead of an unexplained number.pinMode(LED_PIN, OUTPUT)configures the pin as an output. Pins power up as inputs, so forgetting this is a classic reason for an LED that glows faintly or not at all.digitalWrite(pin, HIGH)drives the pin to 5 V andLOWdrives it to 0 V.delay(ms)pauses the whole program for that many milliseconds.Serial.printlnsends text to the Serial Monitor at 9600 baud, which is a handy way to confirm the sketch is running even if the LED wiring is wrong.
Upload and Verify
Click the Verify tick first. The IDE should report that it compiled and show how much flash and RAM the sketch uses. Then click Upload. The TX and RX LEDs on the board flicker while the code transfers, and the LED on pin 9 starts blinking within a couple of seconds. Open the Serial Monitor (the magnifying-glass icon at the top right of the IDE) and set the baud dropdown to 9600 to see the ON and OFF messages.
Going Further: Blinking Without delay()
The standard Blink uses delay(), which freezes the processor. While it waits, the Arduino cannot read a button, check a sensor or run a second LED. That is fine for a first test, but it becomes a serious limit in real projects.
The professional approach is to ask "how long since the last change?" using millis(), which returns the number of milliseconds since the board powered up. The loop runs freely and acts only when enough time has passed:
// Non-blocking blink using millis()
const uint8_t LED_PIN = 9;
const unsigned long INTERVAL_MS = 500;
unsigned long previousMillis = 0;
bool ledState = LOW;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
unsigned long now = millis();
if (now - previousMillis >= INTERVAL_MS) {
previousMillis = now;
ledState = !ledState; // flip the state
digitalWrite(LED_PIN, ledState);
}
// Other work can run here without being blocked:
// read buttons, check sensors, update a display...
}The subtraction now - previousMillis stays correct even when millis() rolls over after about 49 days, because of how unsigned arithmetic wraps. Use unsigned long for these variables. Using int is a common bug that makes the timing fail after about 32 seconds.
Fading With PWM
Pin 9 is one of the six PWM pins, marked with a tilde (~) on the board. PWM switches the pin on and off very quickly and varies the fraction of each cycle it spends HIGH, so the LED appears dimmer or brighter. analogWrite() takes a value from 0 (always off) to 255 (always on):
// LED fade using PWM on pin 9
const uint8_t LED_PIN = 9; // pin 9 supports PWM
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
for (int level = 0; level <= 255; level += 5) { // fade in
analogWrite(LED_PIN, level);
delay(20);
}
for (int level = 255; level >= 0; level -= 5) { // fade out
analogWrite(LED_PIN, level);
delay(20);
}
}Pins 3, 9, 10 and 11 run PWM at about 490 Hz, and pins 5 and 6 at about 980 Hz. Both are far too fast to see as flicker. The name analogWrite is slightly misleading, because the output is a fast digital signal and not a true analog voltage.
Steps
- 1Install Arduino IDE 2 and plug in the Uno with a data-capable USB cable
- 2Select Tools → Board → Arduino Uno and choose the new entry under Tools → Port
- 3Upload the built-in Blink example and confirm the L LED flashes
- 4Calculate or confirm the resistor: 220 Ω for a red LED on a 5 V pin
- 5Wire the LED anode through the resistor to pin 9 and the cathode to GND
- 6Upload the external LED sketch and check the LED blinks and the Serial Monitor prints ON and OFF
- 7Change ON_MS to 100 and OFF_MS to 900 to see a short flash, then upload the millis() version
- 8Upload the PWM fade sketch and watch the LED brighten and dim smoothly
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| No port appears under Tools → Port | Charge-only cable, or a clone board that needs the CH340 driver | Use a data cable and install the CH340 driver |
avrdude: stk500_getsync() error | Wrong port or wrong board selected | Re-select the port and choose Arduino Uno |
| Upload works but the LED stays dark | LED backwards, or both legs of the LED in the same breadboard row | Flip the LED and put its two legs in different rows |
| LED glows very dimly | pinMode missing, so the pin is still an input | Add pinMode(LED_PIN, OUTPUT) in setup() |
| LED always on, never blinks | Wired to 5 V instead of pin 9 | Move the anode wire to digital pin 9 |
| Upload fails when pins 0 or 1 are wired | Those pins are shared with the USB serial link | Disconnect pins 0 and 1 while uploading |
| Fade looks like plain on and off | LED is on a non-PWM pin | Use pin 3, 5, 6, 9, 10 or 11 |
| "Permission denied" when uploading on Linux | Your user isn't in the dialout group | Run sudo usermod -a -G dialout $USER, then log out and back in |
Experiments to Try Next
Once the LED blinks reliably you have proven the whole development chain. Here are some small experiments that build directly on it:
- Morse code: encode your name as patterns of short and long flashes by varying
ON_MSandOFF_MS. - Running lights: wire LEDs to pins 6, 7, 8 and 9, each with its own resistor, and animate them with a
forloop. - Button control: read a push button with
digitalRead()andINPUT_PULLUPso the LED toggles on each press. - Brightness knob: read a potentiometer on A0 with
analogRead()and feed the value toanalogWrite().
You can also test any of these without touching hardware in the SolderHub simulator. To go deeper, continue with Arduino PWM Control, explore every pin, including the power pins, in the Arduino Uno R3 Pinout guide, and see where the Uno sits against bigger boards in Arduino Mega vs Uno.


