Arduino Tutorial - digitalRead Serial Monitor with Button

  • 6 years ago
Arduino Basic Tutorial digitalRead Serial Monitor with Button\r
\r
Reads a digital input on pin 2, prints the result to the serial monitor.\r
\r
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. \r
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.\r
\r
Connections:\r
\r
- One leg of the button connect a resistor.\r
- Green wire connect from digital pin 2 to one leg of the pushbutton.\r
- Leg of the resistor to ground.\r
- The other leg of the button connects to the 5 volt supply.\r
\r
Hardware Required:\r
\r
Arduino\r
Button\r
10k ohm resistor\r
Wires\r
Breadboard\r
\r
Flash Deals -- \r
Mega Stock Clearance -- \r
Arduino Kits -- \r
Anet A8 3D Printer Promotion -- \r
More Budget 3D Printers -- \r
\r
Get to Code:\r
\r
.\r
\r
\r
---

Recommended