In the following program
The button pressed message is sent twice with each press of the button. I know about debounce and thought the delay would cover that (it did help a lot) but it seems the ISR is still executed twice?
Code:
const int buttonPin = 2; // Pin for button
void buttonISR() {
Serial.println("Button Pressed! Sending message...");
delay(1500);
}
void setup() {
Serial.begin(9600); // Initialize USB serial for debugging
pinMode(buttonPin,INPUT); // Set pin as input
attachInterrupt(digitalPinToInterrupt(buttonPin), buttonISR, RISING); // Interrupt on rising edge
}
void loop() {
// Empty loop since processing is handled in ISR
}
The button pressed message is sent twice with each press of the button. I know about debounce and thought the delay would cover that (it did help a lot) but it seems the ISR is still executed twice?