#define BUTTON_PIN_1 12
#define BUTTON_PIN_2 13
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(BUTTON_PIN_1, INPUT);
pinMode(BUTTON_PIN_2, INPUT_PULLUP);
}
int lastState = HIGH;
void loop() {
// put your main code here, to run repeatedly:
int value_1 = digitalRead(BUTTON_PIN_1);
int value_2 = digitalRead(BUTTON_PIN_2);
Serial.print("Tombol 1"); Serial.println(value_1);
Serial.print("Tombol 2"); Serial.println(value_2);
delay(1000);
if (lastState != value_1) {
lastState = value_1;
if (value_1 == HIGH) {
Serial.println(" FALSE ");
}
if(value_1 == LOW) {
Serial.println(" TRUE ");
}
lastState = value_2;
if (value_2 == HIGH) {
Serial.println(" FALSE ");
}
if(value_2 == LOW) {
Serial.println(" TRUE ");
}
}
}