ESP32 - Button - Debounce
When a button is pressed/released or when a switch is toggled, newbies usually think simply that its state is changed from LOW to HIGH or HIGH to LOW. In practice, it is not exactly like that. Because of the mechanical and physical characteristics, the state of the button (or switch) might be toggled between LOW and HIGH several times. This phenomenon is called chattering. The chattering 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||×||ESP-WROOM-32 Dev Module|
|1||×||Micro USB Cable|
Image is developed using Fritzing. Click to enlarge image
Let's see and compare ESP32 code between WITHOUT and WITH debounce and their behaviors.
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 ...
※ NOTE THAT:
Note that this tutorial is incomplete. We will post on our Facebook Page when the tutorial is complete. Like it to get updated.