Content originally posted in LPCWare by fjrg76 on Fri Nov 09 12:43:26 MST 2012
In hardware:
Try to implement a passive RC filter in the uC inputs
In software:
Implent debouncing techniques:
a) Measure the time that the input is in its active state, say low-level. If such a level lasts for at least n cycles, then the inputs is taken as a correct one; otherwise it's discarded.
b) Poll the input and count the different levels, and after some time take as valid input the one that has the majority.