Arduino - Button - Debounce
When a button is pressed/released or when a switch is toggled, you may think that its state is simply changed from LOW to HIGH or HIGH to LOW. In practice, it is not exactly like that. The state of the button (or switch) may be quickly toggled between LOW and HIGH several times, due to mechanical and physical issues. This is called the chattering phenomenon. This phenomenon makes a single press that may be read as multiple presses, resulting in a malfunction in some kinds of applications. This tutorial shows how to eliminate this phenomenon (called debounce the input).
|1||×||Arduino UNO or Genuino UNO|
|1||×||USB 2.0 cable type A/B|
Image is developed using Fritzing. Click to enlarge image
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.
DEBOUNCE_DELAY value depends on the applications. Different applications may use different values.
The debounce method can apply for switch, touch sensor ...