My understanding:
Regarding A/D conversion of a signal: The Nyquist-Shannon sampling theorem states, that an analog signal can be fully reconstructed (D/A converted back) if the sampling rate is >= two times the max. frequency component of that analog signal. Otherwise, aliasing errors occur. To avoid aliasing errors, an analog low pass filter must be applied to the analog signal before sampling. I only consider simple voltage signals, not image processing or whatever more advanced things, to keep it simple.
What I am trying to achieve:
I want to debounce a pushbutton signal, that is connected to a GPIO of a microcontroller.
I check the GPIO value on an interval, say 20 ms. To debounce that, I simply count "HI" values up to 10, and count down if the signal is "LOW". If my counter is over a threshold of let's say 7, I consider the signal high. If it is below 2, I consider the signal LOW. (In between, the signal maintains it's current state.)
This is how I debounce my push button.
For completeness, the button needs to be immune to electromagnetic disturbances.
My question:
Do I have to consider the Nyquist-Shannon sampling theorem here?
In other words: Do I have to make an analog filter (for example an RC lowpass), to be able to debounce the button, or will my approach work?
In other, other words: Is button debouncing related to the Shannon sampling theorem and has to be considered, or is this not applicable regarding button debounce?
Any hint, advice, opinion or comment would be appreciated.