Traffic
light model using an Arduino in Tinkercad
This simple small project uses an Arduino and some LEDs to
duplicate a traffic light. working model It uses code as an inside timer and continues to run
until we cut the Arduino's power supply.
working :
It works exactly he same way like real life traffic LED lights. in our model first we turn on the RED LED and turn it off after 1 sec we can increase the time of on and off of the LED time in coding. same way the two LED's that is Yellow and Green works.
Components Needed:
Crcuit diagram:
Connection:
Red LED connected to the Arduino pin -13
Yellow LED connected to the Arduino pin -12
Green LED connected to the Arduino pin -11
all the ground pin of LED's connected to the ground of an Aduino.
Program: (Block based)
Program: (Arduino Sketch)
void setup()
{
pinMode(13, OUTPUT);//declared as a output
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(12, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(12, LOW);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(11, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(11, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
Working Video:
Comments
Post a Comment
If you any query please comment