How to use evive Digital Pins as Input Pins

About This Tutorial
This tutorial discusses how to configure the digital pins in evive as INPUT in Arduino IDE, with the help of a simple example using evive's tactile switch.
Tutorial Info
Programming Platform:
Estimated Time (hrs):

Components Required

ImageComponentQuantityAvailable in Kit
USB A-B Cable1


As stated in previous tutorial a digital input pin can be in either of the three states namely HIGH,LOW or Floating.

  • 0V – 1.5V: LOW
  • 3.3V – 5V: HIGH
  • 1.5V – 3.3V: floating (can either be HIGH or LOW)

In this tutorial you will be using digital pin 38 of evive as an input since it is connected to tactile switch 1 on evive. You will read the state of digital pin 38 to check when tactile switch is pressed and depending upon state of tactile switch a bar of particular color will be printed on evive screen.

Configuring a Digital Pin as an Input Pin

In evive digital I/O pins are by default set as input pins and hence they don’t need to be explicitly declared as INPUT initially in the program. But it is advised to declare each and every pin as input or output for consistency.

Digital Input pins can be configured as INPUT by using the following statement:

pinMode(pin, INTPUT);

where the pin is the digital pin number you want to initialise as input.

It is often useful to set an input pin to a known state if no external input is present. This can be done by adding a pull-up resistor (connected to +5V), or a pull-down resistor (connected to ground) on the input. A 10KΩ resistor is both a good pull-up and pull-down resistor.

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

Example: Displaying the pin state using evive’s Tactile Switch

evive Tactile Switch Pushbuttons


evive has two tactile switches connected to digital pin 38 and digital pin 39. When pressed, the state of the digital pin is HIGH; otherwise it is LOW.  In this Arduino IDE sketch we will read the state of digital pin 38, which is connected to tactile switch 1 and then display it on the TFT Screen.

Below is the sketch:

evive Digital Input

This Helped
This didn't help
Share this Tutorial
Related Tutorials
Featured Projects

Leave a Reply

Close Menu