Arduino digitalRead Serial Monitor with Button

Arduino Basic Tutorial digitalRead Serial Monitor with Button. Reads a digital input on pin 2, prints the result to the serial monitor.

When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and reads as LOW, or 0.
When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that the pin reads as HIGH, or 1.

Required Hardware
Arduino Board
Push Button
10k ohm Resistor
Jumper Wires
Breadboard

Arduino Compatible SCM & DIY Kits
Electronics Equipments & Tools
Module Board For Arduino

29,856 views
195   

Connections
One leg of the button connect a resistor.
Green wire connect from digital pin 2 to one leg of the pushbutton.
Leg of the resistor to ground.
The other leg of the button connects to the 5 volt supply.

 

shares

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close