const int BUTTON_PIN1 = 12;
const int BUTTON_PIN2 = 14;
int lastState1 = LOW;
int currentState1;
int lastState2 = LOW;
int currentState2;
void setup() {
Serial.begin(9600);
pinMode(BUTTON_PIN1, INPUT_PULLUP);
pinMode(BUTTON_PIN2, INPUT_PULLUP);
}
void loop() {
// read the state of the switch/button:
currentState1 = digitalRead(BUTTON_PIN1);
currentState2 = digitalRead(BUTTON_PIN2);
if (lastState1 == LOW && currentState1 == HIGH)
Serial.println("The button 1 is pressed");
delay(50);
lastState1 = currentState1;
if (lastState2 == LOW && currentState2 == HIGH)
Serial.println("The button 2 is pressed");
delay(50);
lastState2 = currentState2;
}