A push button is an electrical component that is used to connect or disconnect a circuit. They come in a variety of shapes and sizes but with the same function.
In this tutorial, we will learn more about bush buttons and how to use them. We’ll use the push button in a simple project to control the Arduino’s internal LED and print the current state of the button directly on your commuter.
Connect the wires between the push button and the Arduino, as shown in the image below.
Connections from the push button:
• First pin→ Breadboard 5v line
• Second pin→ Arduino pin 2
• Second pin→10KΩ resistor → Breadboard GND line
Now access the serial monitor on your Arduino IDE by clicking on the magnifying glass icon at the top right corner.
Now, as shown in the image below, the serial monitor displays the state of the push button, whether it is pushed or released. as well as the digital read from it.
You can also notice that the Arduino’s built-in led is switched on and off in response to the push button state.