Introduction
- In this article, I have explained about the Smart Signal Light System using Arduino Mega 2560.
- It is used to generate light correctly.
- It will automatically generate the signals.
Parts Of Lists:
- Arduino Mega 2560
- Led-3
- Bread Board
- Push Button
- Hookup Wires
Connections:
Step 1: Connection From LED To Board:
- Connect the LED1 of positive pin to the 03 of the Arduino board.
- Connect the LED2 of positive pin to the 04 of the Arduino board.
- Connect the LED3 of positive pin to the 05 of the Arduino board.
- Connect the LEDS negative pin to the GND commonly.
Step 2: Connection From PUSHBUTTON To Board:
- Connect the positive pin to the 7 of the Arduino board with the positive side. Connect the 5v of the board.
- Connect the negative side to the GND of the board.
Programming
- int one = 03;
- int two = 04;
- int three = 05;
- int btn = 7;
- int state = 0;
- void setup()
- {
- pinMode(one, OUTPUT);
- pinMode(two, OUTPUT);
- pinMode(three, OUTPUT);
- }
- void loop()
- {
- if (digitalRead(btn))
- {
- if (state == 0)
- {
- setLights(HIGH, LOW, LOW);
- state = 1;
- } else if (state == 1)
- {
- setLights(HIGH, HIGH, LOW);
- state = 2;
- } else if (state == 2)
- {
- setLights(LOW, LOW, HIGH);
- state = 3;
- } else if (state == 3)
- {
- setLights(LOW, HIGH, LOW);
- state = 0;
- }
- delay(1000);
- }
- }
- void Traffic(int red, int yellow, int green)
- {
- digitalWrite(one, red);
- digitalWrite(two, yellow);
- digitalWrite(three, green);
- }
- It can glow the lights automatically with the delay times.
- We can set the delay time and watch the LEDs/lights, it changes automatically.
- When the first light glows, the second and third remains off.
- Second light glows the third and first is off.
- Third light glows the first and second is off.
Output:

Figure 1: Output
Read more articles on Arduino:


Sr KarthigaPosted May 25, 2016, 4:20 AM EDT
thank you santhakumar sir
Sr KarthigaPosted May 25, 2016, 4:19 AM EDT
thank you kumaresh
Sr KarthigaPosted May 25, 2016, 4:19 AM EDT
thank you monil sir
Sr KarthigaPosted May 25, 2016, 4:19 AM EDT
Thank you vignesh sir
Santhakumar MunuswamyPosted May 20, 2016, 10:28 PM EDT
Thank you for nice work
Kumaresh RajalingamPosted Apr 24, 2016, 5:35 PM EDT
Nice share
Guest UserPosted Apr 24, 2016, 9:30 AM EDT
Good One
Vignesh ManiTOP 100Posted Apr 24, 2016, 6:20 AM EDT
Good
Sr KarthigaPosted Apr 24, 2016, 5:03 AM EDT
thank you mohankumar sir
Sr KarthigaPosted Apr 24, 2016, 5:03 AM EDT
Thank you vivek sir
Bhuvanesh MohankumarPosted Apr 23, 2016, 1:58 PM EDT
Good
Vivek KumarPosted Apr 23, 2016, 7:39 AM EDT
Nice one
Sr KarthigaPosted Apr 23, 2016, 4:56 AM EDT
thank you shaili sis
Sr KarthigaPosted Apr 23, 2016, 4:55 AM EDT
Thank you saha sir
Shaili DashoraPosted Apr 23, 2016, 3:00 AM EDT
Nice creation Sr Karthiga
Debasis SahaTOP 100Posted Apr 23, 2016, 2:25 AM EDT
Nice One..