int vermelhocar=13;
int amarelocar=12;
int verdecar=11;
int vermelhoped=3;
int verdeped=2;
int botao=7;
int estado=0;
void setup() {
pinMode(vermelhocar, OUTPUT);
pinMode(amarelocar, OUTPUT);
pinMode(verdecar, OUTPUT);
pinMode(vermelhoped, OUTPUT);
pinMode(verdeped, OUTPUT);
pinMode(botao, INPUT);
}
void loop() {
digitalWrite(vermelhocar, LOW);
digitalWrite(amarelocar, LOW);
digitalWrite(verdecar, HIGH);
digitalWrite(vermelhoped, HIGH);
digitalWrite(verdeped, LOW);
estado=digitalRead(botao);
if(estado==HIGH){
digitalWrite(vermelhocar, LOW);
digitalWrite(amarelocar, HIGH);
digitalWrite(verdecar, LOW);
delay(1500);
digitalWrite(vermelhocar, HIGH);
digitalWrite(amarelocar, LOW);
digitalWrite(verdecar, LOW);
digitalWrite(vermelhoped, LOW);
digitalWrite(verdeped, HIGH);
delay(1000);
pisca();
}
}
void pisca(){
for(int i=0;i<10;i++){
digitalWrite(verdeped, LOW);
delay(500);
digitalWrite(verdeped, HIGH);
delay(500);
}
}