Blinking an LED is a fundamental project for Arduino enthusiasts. In this tutorial, we'll go through the process of blinking an LED using the Arduino uno R4 WIFI (steps same for most Arduino boards) and a breadboard. Let's get started!
Materials Needed:
- Arduino Board (Ex: uno)
- Breadboard and jumper wires
- LED
- Resistor (270Ω)
- USB cable for Arduino
- Arduino IDE installed on your computer
Step 1: Set Up the Hardware:
Connect the short leg (cathode) of the LED to GND on the Arduino.
Connect the long leg (anode) of the LED to resistor ( 270Ω) and to pin 13 on the Arduino.
You can connect the components differently on breadboard as long as you follow the same circuit its fine.
Step 2: Connect your Arduino board to your computer
Cables can be different depending on Arduino board. Some can use USB and others Type-C cables. Can connect depending on your board.
Step 3: Writing the codes
In your Arduino IDE add those codes.
// Blinking a single LED
int ledPin = 13; // Pin number for the LED
void setup() {
pinMode(ledPin, OUTPUT); // Sets the LED pin as an output
}
void loop() {
digitalWrite(ledPin, HIGH); // Turn the LED on
delay(1000); // Wait for 1 second
digitalWrite(ledPin, LOW); // Turn the LED off
delay(1000); // Wait for 1 second
}
Step 4: Uploading the codes
Now, make sure that in your Arduino IDE the correct board is selected and click on the upload button.
Your codes should be uploaded successfully.
If the steps above were followed, the led will be blinking every one second 🎉
You can read more on the article 👉🏾here
If you liked this post, you might as well like to checkout on fading an LED.
Fading an LED
Top comments (0)