TRAFFIC SIGNAL CIRCUIT | TINKERCAD
by Advik Shettigar in Circuits > Arduino
1764 Views, 1 Favorites, 0 Comments
TRAFFIC SIGNAL CIRCUIT | TINKERCAD
In this article, I will tell you the steps to make a Traffic Signal circuit using TinkerCad. In this circuit there will be 3 LEDs which will start glowing 1 by 1 after a set interval, in my project it is 5 seconds. First red led will glow for 5 seconds, then yellow led will glow for 5 seconds, at last green led will glow for 5 seconds. This cycle will continue forever till the simulation is on.
Components Required
The required components to make this circuit are as follows:-
- Breadboard
- 3 LEDs (Red, Yellow, Green)
- 3 Resistors
- Arduino UNO R3
Connections
Make the connections as shown in the above picture using TinkerCad Circuits.
CodeBlocks/CodeText
Drag and drop the code blocks or write the code in the TinkerCad software.
// C++ code
//
void setup()
{
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
}
void loop()
{
digitalWrite(1, HIGH);
delay(5000); // Wait for 5000 millisecond(s)
digitalWrite(1, LOW);
digitalWrite(2, HIGH);
delay(5000); // Wait for 5000 millisecond(s)
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
delay(5000); // Wait for 5000 millisecond(s)
digitalWrite(3, LOW);
}