A standard Arduino function for detecting the voltage on an analog pin via ADC.

Calling analogRead(x) (where x is a pin number) allows the Arduino to detect the approximate voltage on its analog pins. This is performed using a 10-bit ADC (Analog to Digital Converter), which takes approximately 100 microseconds.

It returns an integer value between 0 and 1023, which will usually represent the range +0v to +5v. However, the voltage range will be different if the board runs at a different voltage, or if the program has selected a different range by calling analogReference().