Ajantha College and School Students Science Projects materials The Great in project

"In the name of Allah, most
Gracious, most Compassionate"

Phone

044 4213 1795

Mobile

+91 91764 16648
 

Simple LED Projects using Arduino

Simple LED Projects using Arduino

This article is another step forward in learning more about Arduino.  In our previous article, I have written in detail about blinking an LED using Arduino. We have demonstrated 5 simple led based projects using arduino, which will help you to learn its basic concepts.

1. Blinking Two LED’s using arduino

2. Control LED using a Push button switch

3. Toggle an LED using Push button switch

4. Toggle 2 LED’s using a Push button switch

Blinking Two LED’s using Arduino

As a beginner, if you have tried the “Hello World” program to blink an LED using Arduino; you can try to blink Two LED’s as next project. There are 14 I/O (input/output) pins in your Arduino uno board. These pins are numbered from 0 to 13. They can be configured as either input or output in the sketch you create for arduino. If you have learned the “Hello World” program carefully, you now know that input/output configuration of pins has to be done inside the setup() function. So here is the circuit diagram to blink 2 led’s using arduino.

 
stereo amplifier circuit BA5417
 

Sketch to Blink Two LED’s using Arduino

const int LED1 = 12;
const int LED2 = 13;

void setup()
{
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
}

void loop()
{
  digitalWrite(LED1,HIGH);
  delay(1000);
  digitalWrite(LED1,LOW);
  digitalWrite(LED2,HIGH);
  delay(1000);
  digitalWrite(LED2,LOW);
}

The only difference in this sketch is use of 2 pins in output mode. I have used pin number 12 and 13 as output. I have configured them as output inside the setup() function. Inside the loop(), I have written commands to blink LED’s alternatively. When LED1 is ON, LED2 will be OFF. After 1 second LED1 will turn OFF and at the same time LED2 will turn ON. Wait another 1 second and you will see LED2 turning OFF and LED1 turning ON. This cycle repeats.

I have added a photograph of the practical setup I made below.

 
stereo amplifier circuit BA5417