some question on microcontroller

thatoneguy

Joined Feb 19, 2009
6,359
You are probably having problems with "switch bounce".

Add a resistor and capacitor (integrator) to the switch input to eliminate bounce issues. Time constant under 100mS or so. This can also be done in software by doing a "majority of samples" or similar algorithm if using interrupt on change.
 
Top