int Red = 10;
int Yellow = 9;
int Green = 8;
int pushBotton = 7;
int status=0;
void setup() {
pinMode(Red, OUTPUT);
pinMode(Yellow, OUTPUT);
pinMode(Green, OUTPUT);
pinMode(pushBotton, INPUT);
digitalWrite(Red, LOW);
digitalWrite(Yellow, LOW);
digitalWrite(Green, LOW);
}
void loop() {
if(digitalRead(pushBotton) == HIGH)
{
status++;
delay(500);
}
if (status==1)
{
digitalWrite(Yellow, HIGH);
delay(3000);
digitalWrite(Yellow, LOW);
digitalWrite(Red, HIGH);
delay(5000);
digitalWrite(Red, LOW);
digitalWrite(Yellow, HIGH);
delay(2000);
digitalWrite(Yellow, LOW);
digitalWrite(Green, HIGH);
delay(3000);
digitalWrite(Green, LOW);
}
else
{
status=0;
digitalWrite(Red, LOW);
digitalWrite(Yellow, LOW);
digitalWrite(Green, LOW);
}
}