#define hijau 13
#define kuning 12
#define merah 11
#define saklar 5
int status = 0;

void setup() {
  // put your setup code here, to run once:
   pinMode(hijau, OUTPUT);   
   pinMode(kuning, OUTPUT);   
   pinMode(merah, OUTPUT);
   pinMode(saklar, INPUT);   
   Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
 if (digitalRead(saklar)== HIGH) {
   status ++;
   delay(2000);
   Serial.println(status); 
 
  if (status == 1) {
     digitalWrite(hijau, HIGH);
     digitalWrite(kuning, LOW);
     digitalWrite(merah, LOW);
    delay(1000);
  }

  else if (status == 2) {
  digitalWrite(hijau, LOW);
  digitalWrite(kuning, HIGH);
  digitalWrite(merah, LOW);
  delay(1000);
  }

 else if (status == 3)  {
  digitalWrite(hijau, LOW);
  digitalWrite(kuning, LOW);
  digitalWrite(merah, HIGH);
  delay(1000);
 }

 else if (status == 4 ) {
    digitalWrite(hijau, LOW);
    digitalWrite(kuning, LOW);
    digitalWrite(merah, LOW);
    delay(2000);
    status = 0;
  }
 }
}