Hello readers! I recently started working with an Arduino Uno R3, so I thought I’d write a short blog-tutorial on my first experimental program – the Blink program.
What You’ll Need
- Arduino Board (e.g., Arduino Uno)
- Breadboard
- LED
- 220-ohm Resistor
- Jumper Wires
Steps to Create the Blinking LED Circuit
1. Set Up the Circuit
- Insert the LED: Place the LED onto the breadboard. The longer leg (anode) is the positive leg, and the shorter leg (cathode) is the negative leg.
- Connect the Resistor: Connect one end of the 220-ohm resistor to the cathode (short leg) of the LED.
- Wire the LED to the Arduino:
- Connect the anode (long leg) of the LED to a digital pin on the Arduino (e.g., pin 13) using a jumper wire.
- Connect the other end of the resistor to the ground (GND) pin on the Arduino using another jumper wire.
Your connections should look like this:
- LED Anode → Arduino Pin 13
- LED Cathode → Resistor → Arduino GND
2. Write the Code
- Open the Arduino IDE: Launch the Arduino software on your computer.
- Write the Sketch: Enter the following code into the Arduino IDE:
void setup() { pinMode(13, OUTPUT); // Set pin 13 as an output } void loop() { digitalWrite(13, HIGH); // Turn on the LED delay(1000); // Wait for 1 second (1000 milliseconds) digitalWrite(13, LOW); // Turn off the LED delay(1000); // Wait for 1 second }
This code does the following:
setup()
Function: Runs once when the Arduino is powered on. It sets pin 13 as an output.loop()
Function: Runs repeatedly. It turns the LED on, waits for 1 second, turns the LED off, and then waits for another second.
- Upload the Code: Click the “Upload” button in the Arduino IDE. This will compile the code and transfer it to your Arduino board.
3. Test Your Circuit
Once the code has been uploaded, you should see the LED start to blink on and off every second!
Conclusion
Congratulations! You’ve successfully made an LED blink using an Arduino. This simple project introduces you to basic concepts of digital output and programming.
Thanks for reading, guys! I will continue tinkering with the Arduino and hopefully build a project soon!