LED blinking using Arduino
Introduction:
Learning to blink an LED with an Arduino is the "Hello World" of embedded systems. It's easy, enjoyable, and a great place to start for electronics and coding beginners.
Components Required:
Component | Quantity |
---|---|
Arduino Uno (or any Arduino board) | 1 |
LED (Any color) | 1 |
220-ohm Resistor | 1 |
Breadboard | 1 |
Jumper Wires | As needed |
USB Cable | 1 |
Circuit Diagram:
Connection Details:
-
Connect the long leg (anode) of the LED to Arduino pin 13
-
Connect the short leg (cathode) to one end of the 220-ohm resistor
-
Connect the other end of the resistor to GND (Ground)
Arduino code:
void setup() {
pinMode(3, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(3, LOW);
delay(1000);
}
How It Works:
-
The
setup()
function runs once and sets pin 13 as an output. -
The
loop()
function turns the LED on and off repeatedly, with a 1-second delay. -
You can change the delay to make it blink faster or slower.
Output:
Once you upload the code to the Arduino, you’ll see the LED turn ON and OFF every second
Conclusion:
That’s it! You’ve just completed your first Arduino project. This simple blinking LED is your first step into a world of automation, robotics, and IoT.
Comments
Post a Comment