#define merah 13
#define kuning 12
#define hijau 11
#define tombol 7
int status = 0;
void setup() {
// put your setup code here, to run once:
pinMode(hijau, OUTPUT);
pinMode(kuning, OUTPUT);
pinMode(merah, OUTPUT);
pinMode(tombol, INPUT);
digitalWrite(hijau, LOW);
digitalWrite(kuning, LOW);
digitalWrite(merah, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(tombol)==HIGH){
status++;
if(status==1){
digitalWrite(hijau, LOW);
digitalWrite(kuning, HIGH);
digitalWrite(merah, LOW);
delay(3000);
// }
// else if(status==2){
digitalWrite(merah, HIGH);
digitalWrite(hijau, LOW);
digitalWrite(kuning, LOW);
delay(5000);
// }
// else if(status==3){
digitalWrite(hijau, LOW);
digitalWrite(kuning, HIGH);
digitalWrite(merah, LOW);
delay(2000);
// }
// else if(status==4){
digitalWrite(hijau, HIGH);
digitalWrite(kuning, LOW);
digitalWrite(merah, LOW);
status=0;
delay(3000);
digitalWrite(hijau, LOW);
digitalWrite(kuning, LOW);
digitalWrite(merah, LOW);
}else{
digitalWrite(hijau, LOW);
digitalWrite(kuning, LOW);
digitalWrite(merah, LOW);
}
return status;
}
}