Arduino Uno Push Button
This project demonstrates how to interface a push button with an Arduino Uno.
The Arduino reads the state of the push button and prints a message to the Serial Monitor indicating whether the button is pressed or not.
Components Needed
- Arduino UNO Board
- Push Button
- Jumper Wires
- Breadboard
Block Diagram
Hardware Wiring Explanation:
Connect Push Button to Arduino Uno:
Connect one leg of the push button to digital pin 2 on the Arduino Uno.
Connect the other leg of the push button to GND on the Arduino Uno.
Optionally, connect a pull-up resistor (10kΩ) between the digital pin 2 and +5V to ensure reliable operation.
Wire up the push button to the Arduino Uno according to the circuit setup section.
Software (Arduino IDE):
Open the Arduino IDE and create a new sketch.
Copy and paste the provided Arduino code into the sketch.
Upload the code to the Arduino Uno.
Project Operation:
Open the serial monitor with a baud rate of 9600.
Observe the output on the Serial Monitor, which will indicate "Button pressed!" when the button is pressed.
Applications
Notes
Ensure the push button is connected correctly to avoid unintentional triggering.
Consider debounce techniques if the button input is erratic due to mechanical bouncing.
Customize the code to perform specific actions based on button presses as required by your project.