Reading analog pins

The voltage on analog pin is set with potentiometer. The values range from 0 - 1024, which is 10 bit resolution (for UNO)

To read analog values, we use analogRead(pin)

Getting voltage from analog reading

A0*(Vcc/1023.)

Vcc is 5V when the analog device is connected to 5V supply

Sketch

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:

  // read the value of analog pin A0
  // value ranges from 0 - 1024
  // these values are changed by changing the knob of potentiometer
  Serial.println(analogRead(A0));

}