Hi.
I have to check a button with a FALLING interrupt. It works great when the button is pressed. The problem is that when i get up from my chair or move around in the room or close the door, the interrupt will fire too. When i attach the oscilloscope to the interrupt input pin, i see very short peaks during those events. I need to get rid of those interferences, can you please help?
The pin is connected via 10 kOhm resistor to 3.3V (pull-up). I also tried various pull-ups from 470 Ohm to 80 kOhm, with no success.
The button pulls the pin to GND when pressed. Pretty standard setup...
My code:
#define SWITCH_1 10
volatile boolean interrupt_occured = false;
void setup() {
Serial.begin(19200);
attachInterrupt(SWITCH_1, switchPressed, FALLING);
}
void loop() {
if (interrupt_occured)
{
Serial.println("Switch pressed");
}
}
void switchPressed()
{
interrupt_occured = true;
}