AnalogRead

Name
analogRead - Read a 10 bits analog value on a pin.

Description
Some pins can be used as an analog input and the value of the voltage on these inputs can be read. The value is a 10 bit integer value and goes from 0 for 0 Volt (as the normal Vref-) to 1023 for the Vref+, which can be the supply voltage (5 or 3.3 V) or an external supplied refvoltage on a Pic32 board.

On a PIC18F2550, pin 13 to 17 can be used as digital I/O or analog input. If one pin between 13 and 17 is used as analog input, all those pins are configured as analog inputs.
 * Since: Beta 2

Syntax
analogRead(pin); PIC18F2550 - 13 to 17 (see note in description about mixed use as analog and digital pin) PIC32-Pinguino-OTG - A0 - A7 Olimex PIC32 Micro - Provides 8 analog IDE pins on, CON2-(7-16) & CON1-16, which is pin P0-P9 & P16.
 * pin: pin number to read from


 * Output: return a value proportional to the voltage applied on the selected pin ( 0..5V / 0..3.3V on a Pinguino board)
 * ground: return 0
 * +2.5v: return 511 on a PIC18F2550
 * +1.65v;return 511 on a Pinguino board
 * +5v: return 1023 on a PIC18F2550
 * +3.3v;return 1023 on a Pinguino board