Devices & Components
Arduino Uno Rev3
5 mm LED: Red
5 mm LED: Green
DC Power Connector, Jack
Resistor 220 ohm
Resistor 3900 Ohm
General Purpose Transistor NPN
5 mm LED: Yellow
Project description
Code
Code Traffic Light
arduino
1//SEMFORO REAL 2int vermelho = 4; 3int amarelo = 3; 4int verde = 2; 5 6void setup() { 7 pinMode(vermelho, OUTPUT); 8 pinMode(amarelo, OUTPUT); 9 pinMode(verde, OUTPUT); 10 11} 12 13void loop() { 14 digitalWrite(vermelho, HIGH); 15 digitalWrite(amarelo, LOW); 16 digitalWrite(verde, LOW); 17 delay(7000); 18 digitalWrite(vermelho, LOW); 19 digitalWrite(amarelo, LOW); 20 digitalWrite(verde, HIGH); 21 delay(5000); 22 digitalWrite(vermelho, LOW); 23 digitalWrite(amarelo, HIGH); 24 digitalWrite(verde, LOW); 25 delay(2000); 26 27} 28
Downloadable files
Full Circuit of Traffic Light
Full Circuit of Traffic Light
Full Circuit of Traffic Light
Full Circuit of Traffic Light
Comments
Only logged in users can leave comments