Buttons
Overview Any device used to break or complete a circuit The design engineer decides which device should be used for each specific circumstance A switch is a type of “latching” button
Arduino The goal of the button is to alter the voltage entering the digital pins A microcontroller sees CHANGES in voltage If the pin normally has 0V, then pressing a button should connect it to 5v
Arduino Button Pins opposite each other are always connected Pressing the button connects to 2 pins on the left to the 2 pins on the right
Circuit
Circuits – Normally LOW D2 is normally connected to ground through the unpressed button
Circuits – Normally LOW When the button is pressed, the 5V side of the button connects to D2 The resistor prevents a short circuit between 5V and ground when the button is pressed
Coding
Coding Or more simply
Complete the Button lab in the book