Pages: [1]   Go Down
Author Topic: analogread is this right  (Read 538 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 27, 2011, 08:51:52 am by AWOL » Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

"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.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: