🔌 Getting Started with Electronics: Blinking LED with Arduino
🎯 Goal
Learn how to make an LED blink using an Arduino. This is the “Hello, World!” of electronics.
🧰 What You Need
Component | Quantity |
---|---|
Arduino Uno/Nano | 1 |
LED (any color) | 1 |
Resistor (220Ω) | 1 |
Breadboard | 1 |
Jumper wires | 3-4 |
USB cable (for Arduino) | 1 |
🔧 Wiring Diagram
- Connect LED:
- Long leg (anode) → Breadboard → Jumper wire → Arduino pin 13 Short leg (cathode) → Resistor → Breadboard → Arduino GND
Arduino Pin 13 ──> LED (+) LED (–) ──> 220Ω Resistor ──> GND
💻 Arduino Code
Open the Arduino IDE and upload the following code:
void setup() {
pinMode(13, OUTPUT); // Set pin 13 as output
}
void loop() {
digitalWrite(13, HIGH); // Turn LED ON
delay(1000); // Wait 1 second
digitalWrite(13, LOW); // Turn LED OFF
delay(1000); // Wait 1 second
}
🔍 Explanation
setup()
runs once when the board turns on.loop()
runs continuously.digitalWrite(pin, HIGH/LOW)
controls voltage to the pin.delay(milliseconds)
pauses the code for a while.
✅ What You Learn
- Basic circuit building (LED + resistor)
- Arduino pin control
- Writing and uploading code to a microcontroller