const int ledmerah = 12;
const int ledkuning = 11;
const int ledhijau = 10;
const int btnmerah = 5;
const int btnhijau = 4;
int i=0;
int buttonmerah ;
int buttonhijau ;




void setup() {
pinMode(ledmerah, OUTPUT);
pinMode(ledkuning, OUTPUT);
pinMode(ledhijau, OUTPUT);
pinMode(btnmerah, INPUT);
pinMode(btnhijau, INPUT);


}

void loop() {
  buttonmerah=digitalRead(btnmerah);
  if(buttonmerah==1){
    i++;
    delay(300);
  }
  buttonhijau=digitalRead(btnhijau);
  if(buttonhijau==1){
    i--;
    delay(300);
  }
  switch(i){
    case 1:
    digitalWrite(ledmerah, HIGH);
    digitalWrite(ledkuning, LOW);
    digitalWrite(ledhijau, LOW);
    break;

    case 2:
    digitalWrite(ledkuning, HIGH);
    digitalWrite(ledhijau, LOW);
    digitalWrite(ledmerah, LOW);
    break;

    case 3:
    digitalWrite(ledhijau, HIGH);
    digitalWrite(ledmerah, LOW);
    digitalWrite(ledkuning,LOW);
    break;

    case 4:
    digitalWrite(ledhijau, HIGH);
    digitalWrite(ledmerah, HIGH);
    digitalWrite(ledkuning, HIGH);

    default:
    break;

  }



 
}