Having a problem with an Arduino project. I'm using a piezo and MOSFET to trigger an interrupt, which then calls a function that turns on/off LEDs and such. In theory, when the piezo is 'tapped,' voltage is applied to the MOSFET gate. The interrupt is connected to Digital Pin 2, which is connected to the 'Drain' of the MOSFET. Essentially, when the piezo is tapped, the interrupt is called.
My problem is this: one tap on the piezo registers several values, sometimes as many as 4 or 5. I only want the 'first' value - the max value from each tap. I checked this on the serial monitor - one tap might give me (for example) readings of 855, 560, 301, and 85.
In this case, the 855 and 560 values both trigger "RISING" and this the interrupt is called. How can I fix this, so the interrupt is only called once per 'tap?'
The obvious solution is to add a delay in the interrupt function, but after doing some research I found I can't do this (something to do with the 'delay' function relying on interrupts itself).
I need to prevent the interrupt from being called multiple times from the same 'tap' - please help!