7 ms·
Yep, we're just disagreeing over minutiae :-) For the sensors, it seems to me that a debounce routine wouldn't work, and (this is assuming the sensor is giving
by Grishnakh 11y ago
Yep, we're just disagreeing over minutiae :-)
For the sensors, it seems to me that a debounce routine wouldn't work, and (this is assuming the sensor is giving an analog reading, not an on-off binary reading) what you really want there is some kind of averaging routine. Usually, the way a debounce routine works is that you look for a state transition (off->on), and then wait 30ms (general rule of thumb for human-actuated switch) and look again to make sure that the state is still "on" and then you do your operation based on that. But for analog sensors, you probably want something that's more like a running average so the readings don't vary too much, and one erroneous or too-extreme reading doesn't affect things much.
I could be wrong though; this is probably highly application-dependent.