HOW TO READ AN ANALOG INPUT. ARDUINO IDE

HOW TO READ AN ANALOG INPUT. ARDUINO IDE

Before reading an analog 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 AnalogRead().  This function is used to read an analog signal (from 0 to 255).

 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:

AnalogRead(pin);

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

Code Example, reading from an analoglRead:

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

void loop() { analogRead(I0_2); }

SEE ALSO: HOW TO USE THE MAPPING PINS OF INDUSTRIAL SHIELDS BOARDSHOW TO WRITE A DIGITAL OUTPUT. ARDUINO IDE, HOW TO READ A DIGITAL INPUT. ARDUINO IDEHOW TO WRITE AN ANALOG OUTPUT. ARDUINO IDE

Comments are closed.