Switches (buttons, pushbuttons, tact switches) are commonly used with Arduino. But, for beginners, it’s sometimes irritating when it comes to wire them up correctly. Some of their terminals are shorted with each other. Such a switch doesn’t work if putted in reversely. Because of that, here’s some words of explanation.
For instance, we have a button like this:
As you can see, it has four terminals organised in two pairs. These pairs are shorted when we are pushing the button. Which of them are which? Maybe this picture will be helpful:
And here is a photo with a switch symbol shown:
Now it’s clear that proper orientation is the crucial thing. Turning the switch by 90 degrees causes permanent short – the button will act as a jumper, not as switch.
For even cleaner explanation, example of a working circuit:
And this is how it looks with schematic:
This switch shorts the resistor to ground. How to detect whether the button is pressed or not? Read more in the article about Family Feud.