little confusion in analog stuffs

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
bhuvaneshnick
 
Posts: 20
Joined: Wed Jan 01, 2014 1:23 am

little confusion in analog stuffs

Post by bhuvaneshnick »

Code: Select all

void setup()
{
  Serial.begin(9600);
 }
void loop()
{
  int a= analogRead(3);
  Serial.println(a);
  delay(1000);
}
but i have not connected anything to that analog pin but i am getting values around 500.whats the reason for that

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: little confusion in analog stuffs

Post by adafruit_support_bill »

The pin has no idea if there is anything connected. It only knows the voltage. If you have nothing connected, the pin voltage will be 'floating' and the value will be undefined.

bhuvaneshnick
 
Posts: 20
Joined: Wed Jan 01, 2014 1:23 am

Re: little confusion in analog stuffs

Post by bhuvaneshnick »

Thank you.and in this forum i have not noticed any button to say thanks or to give rating for answer.actually is it or not

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”