debounce problem

dc42:
Although TCSC47's suggestions are valid and workable, the whole point of microcontrollers is that by using software they can do in a single device many functions that previously we had to build separate hardware to do.

I think your sentence is missing "if it's better, or faster, or cheaper without compromising functionality" between "do" and "."

On the other hand, if timing is critical, then misguided attempts to guess when a switch has settled into a stable position, that involve timing loops, are exactly the sort of thing that a couple of resistors and a capacitor will fix for you easily and cheaply.

Yes, I used an italic full stop. I hope anyone who remembers Algol-60 smiled.