Go Down

Topic: analogread is this right (Read 756 times) previous topic - next topic

I was quickly testing circ 0-9 in the little book(photo resistor example), but it didnt work, after much buggering arround I worked out that the analogread just returns jibberish even if there is nothing attached to the pins.

it returns random numbers between 250 to 400 roughly

for(Ctr=0;Ctr!=13;Ctr++)
{
lightLevel=analogRead(Ctr);
Serial.println(lightLevel);
delay(500);
}

I accept that maybe my little photsensor is buggered, is it normal for the analogread to return nonsense if nothing is plugged in. I would have expected it to be zero.

AWOL

#1
Jun 27, 2011, 03:49 pm Last Edit: Jun 27, 2011, 03:51 pm by AWOL Reason: 1
Yes, that's completely normal.
Google "floating pin" or "floating input"

Quote
I was quickly testing circ 0-9 in the little book(photo resistor example)

I have no idea what you're asking here.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Now that i know what to look for, i managed to research the floating data, thank you.

as for what was i talking about,
http://www.instructables.com/id/Arduino-Expermentation-Kit-How-to-get-Started-wi/step11/Light-Photo-Resistors-CIRC09/

simple sensor circut. I have the booklet, i thought it came with all arduinos :).

AWOL

The one or two Instructables for the Arduino I have read have been truly awful - they really need to get hold of some moderators at that site.
Be careful!
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

I worked it out, what a noob i am, i had it in digital ports, not analog.

Go Up