Taking LED sequencing to Next Level with Arduino
A Step-by-Step Tutorial
Hi Guys!
Welcome to the world of Arduino.
Today we are at Article no. 3 and I am more excited to share it with you. These articles are step by step tutorials.
So if you are a beginner you can learn and go to advance level of Arduino.
Today our problem is "There are 3 leds, make a project that firstly one led blinks 5 times, then second led blinks 5 times and then third."
So we can use 3 leds of different colours such as red, green and yellow.
Circuit
Make circuit on breadboard.
Use 3 resistors of 330 ohm resistance, one resistor with one led.
Connect one leg of resistor with digital pin 13 and other leg to red led long leg.
Similarly connect one leg of resistor with digital pin 12 and other leg to led long leg.
Now connect the one leg of third resistor with digital pin 11 and then other leg to led long leg.
Connect all short legs of leds to ground.
Circuit is completed.
Code
Now it's turn to write code.
void setup ()
{
pinMode(13, OUTPUT);
pinMode (12, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite (13, LOW);
delay (1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite (13, LOW);
delay (1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite (13, LOW);
delay (1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite (13, LOW);
delay (1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite (13, LOW);
delay (1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite (12, LOW);
delay (1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite (12, LOW);
delay (1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite (12, LOW);
delay (1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite (12, LOW);
delay (1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite (12, LOW);
delay (1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite (11, LOW);
delay (1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite (11, LOW);
delay (1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite (11, LOW);
delay (1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite (11, LOW);
delay (1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite (11, LOW);
delay (1000);
}
We write each code 5 times as each led will blink 5 time.
Now upload the code on Arduino board, by connecting arduino to your laptop.
Conclusion
Hence Leds will start blinking. Wow Amazing 🤩.
We are successful.
You can change the delay time and number of blinking too.
Practice it and tell me in comments that you enjoyed this basic project ☺️.
Best of luck.


Comments
Post a Comment