I will show how to make a traffic light on the board Arduino uno
It is very simple
There are two options, the first on the breadboard (usually in each set of arduino), the second on the shield (Aliexpres only 60-75 rubles)
The first is a shield
I apologize for its quality
we make a very simple soldering, to the 12, 11 and 10 output we solder the resistance of 220 ohms and the LEDs 12 - red, 11 - yellow, 10 - green and all this output to any GND
Second - breadboard
Here it’s still simpler, just like on the shield, we conduct wires to the LEDs, we all output to the minus, and there we add resistance by throwing it to another minus and there we draw the wire to GND.
And here's the traffic light program
void setup () {
pinMode (12, OUTPUT);
pinMode (11, OUTPUT);
pinMode (10, OUTPUT);
}
void loop () {
digitalWrite (12, HIGH);
delay (3000);
digitalWrite (11, HIGH);
delay (1000);
digitalWrite (12, LOW);
digitalWrite (11, LOW);
digitalWrite (10, HIGH);
delay (3000);
digitalWrite (10, LOW);
delay (500);
digitalWrite (10, HIGH);
delay (500);
digitalWrite (10, LOW);
delay (500);
digitalWrite (10, HIGH);
delay (500);
digitalWrite (10, LOW);
delay (500);
digitalWrite (10, HIGH);
delay (500);
digitalWrite (10, LOW);
digitalWrite (11, HIGH);
delay (2000);
digitalWrite (11, LOW);
}
That's all, I hope you succeed !!!