Digital Input/Output Pins

Under the Magic Lid of evive, there are 28 Digital 5V Input and Output (I/O) pins.

Digital I/O stands for Digital Input and Output. Digital Inputs allow a microcontroller to detect logic states, and Digital Outputs allow a microcontroller to output logic states.

Digital Input: 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.

Digital Output: A digital output allows you to control a voltage with evive. If evive instructs the output to be high, the output will produce a voltage (generally about 5 or 3.3 volts). If evive instructs the output to be LOW, it is connected to ground and produces no voltage.

Using the 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 pin 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.

If the pin is configured as INPUT_PULLUP during initialisation, it inverts the behaviour of the INPUT mode, where HIGH means the sensor is OFF and LOW means the sensor is ON. It is because there are 20K pullup resistors built into the Atmega chip that can be accessed from software.

Using the digital pin as Output

Pins can be configured as OUTPUT with pinMode(pin, OUTPUT), where the pin is the digital pin number you want to initialise as output. These pins are also in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This is enough current to brightly light up an LED (don’t forget the series resistor), or run many sensors, for example, but not enough current to run most relays, solenoids, or motors.

Short circuits on digital pins, or attempting to run high current devices from them, can damage or destroy the output transistors in the pin, or damage the entire Atmega chip. Often this will result in a “dead” pin in the microcontroller but the remaining chip will still function adequately. For this reason, it is a good idea to connect OUTPUT pins to other devices with 470Ω or 1kΩ resistors, unless maximum current draw from the pins is required for a particular application.


Using digitalWrite() function in Arduino IDE, you can write a digital pin, to a HIGH or LOW value.

If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V for HIGH, 0V for LOW.

If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pull-up on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor.

The analog input pins can also be used as digital pins, referred to as A0, A1, etc.



Using digitalRead() function in Arduino IDE, you can read the value from a specific digital pin as HIGH or LOW.