int btnBlue = 11, btnGreen = 12;
int ledBlue = 3, ledGreen = 2;
int prevBtnBlueState = LOW;
void setup() {
pinMode(btnBlue, INPUT);
pinMode(btnGreen, INPUT);
pinMode(ledBlue, OUTPUT);
pinMode(ledGreen, OUTPUT);
}
void loop() {
int btnBlueState = digitalRead(btnBlue);
int btnGreenState = digitalRead(btnGreen);
if (btnBlueState == LOW && prevBtnBlueState == HIGH) {
delay(250); // Penundaan untuk debouncing
digitalWrite(ledBlue, !digitalRead(ledBlue));
}
prevBtnBlueState = btnBlueState;
digitalWrite(ledGreen, btnGreenState == HIGH);
}