#define LED_hijau 13
#define LED_biru 12
#define LED_merah 11
#define tombol 7
int status = 0;
void setup() {
// put your setup code here, to run
pinMode(LED_hijau, OUTPUT);
pinMode(LED_biru, OUTPUT);
pinMode(LED_merah, OUTPUT);
pinMode(tombol, INPUT);
digitalWrite(LED_hijau, LOW);
digitalWrite(LED_biru, LOW);
digitalWrite(LED_merah, LOW);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run
if(digitalRead(tombol) == HIGH){
status++;
delay(100);
}
if(status == 1){
digitalWrite(LED_hijau, HIGH);
Serial.println("LED Hijau On");
}
else if(status == 2){
digitalWrite(LED_biru, HIGH);
Serial.println("LED Biru On");
}
else if(status == 3){
digitalWrite(LED_merah, HIGH);
Serial.println("LED Merah On");
}
else if(status == 4){
status = 0;
}
else{
digitalWrite(LED_hijau, LOW);
digitalWrite(LED_biru, LOW);
digitalWrite(LED_merah, LOW);
Serial.println("Semua LED Off");
}
}