Рет қаралды 66,648
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: amzn.to/2LZr6t4
Push Button: amzn.to/3k79Bnh
10k ohm Resistor: amzn.to/3bj2HY9
Jumper Wires: amzn.to/3doetmT
Breadboard: amzn.to/3qxLxwm
Recommended Items:
Use Your Muscles in Project - amzn.to/3wdL45C
37 Sensor & Module Packages - amzn.to/3m66WeQ
Try this Robot Arm - amzn.to/3fq8DCl
Best Resin 3D Printer - amzn.to/39tY8KB
Arduino Compatible Kits - bit.ly/2J2AFF7
Banggood Spring Sale - bit.ly/3slMbOn
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.
Source Code: create.arduino...
Social Media:
/ mertarduino
/ mertarduino