int red = 1;
int yellow = 3;
int green = 2;
int tombol = 5;
void setup() {
// put your setup code here, to run once:
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
pinMode(tombol, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(tombol) == HIGH){
for(int i = 0; i <= 3; i++){
digitalWrite(yellow, HIGH);
delay(1000);
digitalWrite(yellow, LOW);
}
for(int i = 0; i <= 5; i++){
digitalWrite(red, HIGH);
delay(1000);
digitalWrite(red, LOW);
}
for(int i = 0; i <= 2; i++){
digitalWrite(yellow, HIGH);
delay(1000);
digitalWrite(yellow, LOW);
}
delay(5000);
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
for(int i = 0; i <= 3; i++){
digitalWrite(green, HIGH);
delay(1000);
}
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(green, LOW);
} else{
digitalWrite(red, LOW);
digitalWrite(yellow, LOW);
digitalWrite(green, LOW);
}
}