Analog Input Error Reading

i tried to read the value of the battery AT +portion ,i got some 1024 when connected when disconnected it shows some value >0 not 0 how to correct this error???

When you say disconnected, do you mean floating?

Post your code and post a photo of a pencil drawing showing all your connections.

Please post your program using the code button </> so it looks like this


void setup() {


void loop() {
  float sensorValue=analogRead(A0);

An observation

float sensorValue=analogRead(A0);

analogRead() returns an integer so assigning it to a float is a waste of time.

How is A0 wired when it is disconnected from the battery ?