Updated: May 13, 2022
Digital Values are used to represent the analog values in discrete bands. These values help the devices to process the function easier, faster, and in a secure way. The two digital values are 0's and 1's. By using these values multiple operations can be performed. Generally, the 1 represents a "HIGH" value and the 0 represents the "LOW" value.
This article describes how to read a Digital value from Arduino using Push Button and the Arduino Code. Let's begin with the requirements to build the project.
1. Arduino UNO R3
Arduino #UNO R3 is the most commonly used and latest version among the Arduino board. Arduino Board can address inputs such as light on a sensor, Twitter information, a finger on a button, and turn it to an output such as initiating a motor, turning on an LED, advertising something online. All of this can be done by transferring a set of instructions to the microcontroller on the board by the use of the #Arduino programming language.
Buy Arduino UNO R3 from here.
2. Push Button
Push Buttons are simple devices used for switching control. It is easy to use and starts or stops the function when connected in a circuit. The Push Button has 4 pins.
Buy Push Button from here.
Resistors are passive devices that restrict the flow of current or divide the voltage through the circuit. The input power passes through these resistors and then to the sensors to avoid damage. Here in this project, a 10K ohm resistor is used.
Buy Resistors from here.
5. Jumper Wires
These are the main components that are used to establish the connections between different devices of the circuit. There are three types male to female, female to female, and male to male.
Buy Jumper Wires from here.
6. USB Cable
This cable is used to connect the #development boards to the power supply. It also helps in the transmission of data.
Buy USB Cable from here.
1. Arduino IDE
To build the circuit breadboard or PCB (Printed Circuit Board) anything can be used. The breadboard helps in testing the circuit and the PCB will provide a permanent circuit in the board. The connection between the Arduino Board and the #Push Button by using jumper wires involves the following steps:
The Push Button has 4- pins in which one of the pins is connected to the Digital pin 2 of the Arduino board.
Another pin is connected to the 10 K ohm resistor and another side of the resistor is connected to the negative terminal of the breadboard.
Finally, in the remaining 2 pins, one is connected to the 5Volt of the Arduino, and another one is connected to the Ground pin of the Arduino board by connecting to the negative terminal of the breadboard to establish a common ground connection.
The working of the circuit is very simple. The Push #Button receives the supply voltage from the Arduino board. Initially, the button state is assigned to 0. The below image shows the picture of the circuit when the code is not applied.
On uploading the program to the Arduino board by using a #USB cable. Compile the code and open the Serial Monitor, it displays the Digital value has "0" that we initially assigned it. Now press the push button to change the Digital Value to "1" and it will be displayed on the serial monitor. You can again change the value by pressing the Push Button.
Video explanation with the practical implementation, for a more beneficial understanding.
Video By - Harshit Gupta
Take the First step today to design the circuit, learn to read the digital values by using the #Pushbutton. With the help of this basic designing article and circuit build your own circuits by applying them in different applications by adding elements and modifying the code according to your wish.