@scsc_tech, I am going to beat @BDub to the reply, muahaha!
- These sensors will bounce by their very nature - vibration sensing! You can easily add a delay in the interrupt service routine that makes use of millis() to effectively “remove” bounce. @chap, wrote a simple button interrupt debouncer recently:
-
You cannot call ANY delay function in an ISR and neither should you. The “delay” in @chap’s ISR uses the millis() counter instead of a delay to achieve the same thing.
-
I have not looked at the code @BDub is referring to but given that he’s pretty smart, then I would have to agree. Having a single ISR called for multi-pin changes just means having to do more work in that ISR to detect which pin(s) triggered the interrupt.
My question is whether you need debounce at all. What you need is to start a timer and then wait for the vibration sensors to react. Assuming that each sensor has no “noise”, that is ambient vibrations that set them off randomly, then you can record the time for a given sensor on the first “event” from that sensor, then ignore further events until you reset everything. So the ISR fires, looks at which pin changed states and records the time for that pin in a pin timer array. Once all times are recorded, then your cycle is complete. At least that’s what I guess your trying to do.