Switches, Debouncing and the Arduino

Aidan just shared a new tutorial: "Switches, Debouncing and the Arduino"



When we boil it down, everyday interactions with electronics are usually limited to controlling stuff with switches. Whether it be turning on the lights, switching on your laptop or turning on the kettle, all examples of how a physical switch works t…

Read more

1 Like

Great write up @Aidan, debouncing is what really gets people who just start out with switches

1 Like

Hello,
I’m new to Arduino so excuse my newbness. Why do we even need ‘buttonState’. Can’t we obtain the same results by just using ‘reading’? Great post!

Hello, welcome to our forum!

The reason why is due to the fact the switch isn’t latching, it’s only on when being held down. And we use a little logic to confirm that the switch was actually pressed before changing the current value (i.e. buttonState). Therefore to maintain a consistent state we need to store a variable. No worries, everyone here is here to help!

Bryce
Core Electronics | Support

2 Likes