
HOW TO READ A DIGITAL INPUT. ARDUINO IDE
Before reading a digital input it is needed to set the pin as INPUT. See the following post to configure a pin.
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.
Code Example, reading from a digitalRead:
void setup() {
pinMode(I0_2,INPUT); } void loop() { digitalRead(I0_2);
}
SEE ALSO: HOW TO USE THE MAPPING PINS OF INDUSTRIAL SHIELDS BOARDS