Why needs debounce for button

Why needs debounce for the button? When needs debounce for the button, when don't need it?

Answer

Not only button but also ON/OFF switch, limit switch, and touch sensor need to be debounced.

TL;DR

If not debounce for the button, It results in a malfunction in the following cases:

Reason

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 or debounce phenomenon. This phenomenon makes a single press that may be read as multiple presses, resulting in a malfunction in some kinds of applications.

Arduino chattering phenomenon

When needs debounce, When don't need it?

When needs debounce

When don't need to debounce

The Best Arduino Starter Kit

※ OUR MESSAGES