In the previous tutorial you have learned about how to use digital pin as voltage output pins. In this tutorial we will learn how to use them as Input pins.

A digital input detects if a voltage is above/below a specific threshold. If the voltage is higher than some value, evive will detect the digital input as HIGH/1. If the voltage is lower than some value, evive will detect the digital input as LOW/0.

In Analog vs Digital tutorial we have seen how to break an analog signal for input:

  • 0V – 0.8V is LOW
  • 2V – 5V is HIGH
  • 8V – 2V is floating (can be HIGH or LOW)

Configuring a digital pin as INPUT

evive digital I/O pins are default assigned as inputs and hence they don’t need to be explicitly declared as input initially in the program. But it is advisable that one should declare each and every pins as input or output for consistency.

Digital Input pins can be configured as pinMode(pin, INPUT), where the pin is the digital pin number you want to initialise. Often it is useful to steer an input pin to a known state if no input is present. This can be done by adding a pullup resistor (to +5V), or a pulldown resistor (resistor to ground) on the input. A 10K resistor is a good value for a pullup or pulldown resistor.

digitalRead(Pin) is used for digital input in Arduino IDE. It returns 1 if it reads HIGH and 0 when it reads LOW.


evive Tactile Switch Pushbuttons

evive has a tactile switch connected to digital pin 38 and digital pin 39. So, when it is pressed, digital pin is HIGH and when it is free, digital pin is LOW. We will read the state of the digital pin and display it on the TFT Screen. Given below is the code and demonstrate of digital input.

evive Digital Input