Look for in our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

How to read a Digital Input - Arduino IDE

Introduction

On this post it will be shown how to read a Digital Input using Arduino IDE


Requirements

Ethernet or 20 I/Os PLC:      Ethernet PLC             20 I/Os PLC     

Industrial Shields boards:   Industrial Shields Boards

 

Description

The function for reading from a digital input using Arduino IDE is digitalRead().  This function is used to read a digital signal (high or low).

 On Industrial Shields equipment’s is followed with the corresponding pinout. This functions are normally used inside the loop() function.

*With next version of Industrial Shields boards won’t be necessary to configure the pins, just selecting the properly board, I/O’s will be automatically configured. 


Next is showed the syntax:

digitalRead(pin);

Pin: Could be any industrial shields equipment pin or any Arduino board pin that you wish to set. 


Example

Code Example, reading from a digitalRead:

void setup() {
pinMode(I0_2,INPUT);
}

void loop() {
digitalRead(I0_2);
}