Arduino Uno First Program: Blink an LED (Complete Beginner Setup Guide)
Upload your first Arduino Uno program. Install Arduino IDE, fix COM port and CH340 driver issues, and blink the built-in and an external LED.
Every Arduino journey starts with one small LED turning on and off. It looks simple, but this one project proves that your computer, cable, driver, board and code all work together. Once Blink works, every other project — distance meters, robots, IoT — is the same process with more parts.
In this guide you will install the Arduino IDE, connect your Uno, upload a program, blink the built-in LED, and then blink an external LED on a breadboard. We also cover the problems most beginners in Nepal hit, especially with clone boards that use the CH340 USB chip.
What you need
| Item | Qty | Notes |
|---|---|---|
| Arduino Uno (original or clone) | 1 | Clones work the same; many use a CH340 USB chip |
| USB cable (Type-A to Type-B) | 1 | Must be a data cable, not "charge only" |
| Computer (Windows, macOS or Linux) | 1 | For Arduino IDE 2 |
| Breadboard (half size) | 1 | |
| LED 5 mm, any colour | 1 | Long leg = anode (+) |
| Resistor 220 Ω | 1 | Red-red-brown; 330 Ω also fine |
| Jumper wires, male-to-male | 2 |
All of these are in the ElectroDai "Starter" parts list.
Wiring table (external LED)
| Arduino Uno pin | Connects to |
|---|---|
| D8 | 220 Ω resistor, one end |
| — | 220 Ω resistor, other end → LED long leg (anode) |
| GND | LED short leg (cathode) |
Why the resistor? Without it, the LED pulls too much current and can damage the LED and the Arduino pin. With 5 V, a red LED (about 2 V) and 220 Ω, the current is about (5 − 2) ÷ 220 ≈ 14 mA, which is safe for both. Arduino pins should stay at or under 20 mA for long life.
Step 1: Install Arduino IDE 2
- Download Arduino IDE 2 from the official Arduino website (arduino.cc → Software).
- Install it with the default options. On Windows, allow the driver installs when asked.
- Open the IDE. You will see an empty sketch with
setup()andloop().
Step 2: Connect the board and pick the port
- Plug the Uno into your computer. The green ON LED should light.
- In the IDE, open Tools → Board → Arduino AVR Boards → Arduino Uno.
- Open Tools → Port and select the port that appeared when you plugged in the board:
- Windows:
COM3,COM4, etc. - macOS:
/dev/cu.usbmodem…(original) or/dev/cu.usbserial…//dev/cu.wchusbserial…(CH340 clone) - Linux:
/dev/ttyACM0(original) or/dev/ttyUSB0(clone)
- Windows:
No port? Unplug and plug again and see which port appears. If nothing appears, see Troubleshooting below — usually it is the cable or the CH340 driver.
Step 3: The code
Copy this into the IDE (replace everything in the empty sketch).
/*
ElectroDai - Arduino Uno First Blink
Blinks the built-in LED (pin 13) and an external LED on pin 8 together.
Wiring: D8 -> 220 ohm resistor -> LED long leg; LED short leg -> GND
*/
const int EXTERNAL_LED_PIN = 8; // external LED through 220 ohm resistor
const unsigned long ON_TIME_MS = 500; // how long the LED stays ON (milliseconds)
const unsigned long OFF_TIME_MS = 500; // how long the LED stays OFF
void setup() {
// setup() runs once when the board powers up or resets
pinMode(LED_BUILTIN, OUTPUT); // LED_BUILTIN is pin 13 on the Uno
pinMode(EXTERNAL_LED_PIN, OUTPUT);
Serial.begin(9600); // open the Serial Monitor at 9600 baud to see messages
Serial.println("ElectroDai blink started");
}
void loop() {
// loop() runs again and again forever
digitalWrite(LED_BUILTIN, HIGH); // HIGH = 5 V = LED on
digitalWrite(EXTERNAL_LED_PIN, HIGH);
Serial.println("LED ON");
delay(ON_TIME_MS); // wait
digitalWrite(LED_BUILTIN, LOW); // LOW = 0 V = LED off
digitalWrite(EXTERNAL_LED_PIN, LOW);
Serial.println("LED OFF");
delay(OFF_TIME_MS);
}
Step 4: Upload
- Click the ✓ Verify button. The bottom panel should say "Done compiling".
- Click the → Upload button. The TX/RX LEDs on the board flicker, then the IDE says "Done uploading".
- The small LED marked L on the board now blinks once per second.
Step 5: Add the external LED
- Unplug the USB cable before wiring. This is a good habit for every project.
- Place the LED on the breadboard. Long leg in one row, short leg in another row.
- Connect the 220 Ω resistor from the long-leg row to a free row.
- Jumper wire: D8 → the resistor's free row.
- Jumper wire: GND → the short-leg row.
- Plug the USB back in. Both LEDs blink together. No need to upload again — the program stays in the Uno's memory.
Step 6: Play with it
- Change
ON_TIME_MSto100andOFF_TIME_MSto900— a short flash, like a beacon. - Change both to
50— fast blinking. - Open Tools → Serial Monitor, set it to 9600 baud, and watch the "LED ON / LED OFF" messages. Serial printing is how you will debug every future project.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| No port shows in Tools → Port | Charge-only USB cable | Try a cable that you know transfers data |
| No port, clone board | CH340 driver missing | Install the CH340 driver (from the chip maker WCH), restart the IDE |
avrdude: stk500_recv(): programmer is not responding |
Wrong port, or something connected to D0/D1 | Select the right port; remove wires from D0/D1 during upload |
| Upload works but external LED is dark | LED backwards | Long leg must go to the resistor/D8 side |
| External LED still dark | Wires in wrong breadboard rows | Check the LED and resistor share a row; check the GND wire |
| Board LED L blinks but ON LED is off | Damaged power LED (rare) | Board still works; ignore |
| "Board at COMx is not available" | Port changed after re-plugging | Choose the port again in Tools → Port |
FAQ
Is a clone Uno OK for learning? Yes. Clones use the same ATmega328P chip and run the same code. The main difference is the USB chip (often CH340), which may need a driver on Windows and older macOS.
Can I use a pin other than 8?
Yes. Any digital pin from D2 to D13 works. Change EXTERNAL_LED_PIN to match. Avoid D0 and D1 — they are used for USB communication.
Do I need to keep the computer connected? No. The program is saved inside the Uno. You can power it from a USB phone charger or a 7–12 V adapter on the DC jack, and it will blink on its own.
Watch the video
📺 [VIDEO PLACEHOLDER — embed ElectroDai long video: "Arduino Uno First Program — Blink an LED (Setup + Fixes)"]
Next project: HC-SR04 Distance Meter with 16x2 I2C LCD — your first real sensor project.