Society of Robots - Robot Forum

Software => Software => Topic started by: silo_xtreme on February 16, 2008, 12:53:17 PM

Title: a2dConvert8bit returning wrong values
Post by: silo_xtreme on February 16, 2008, 12:53:17 PM
Hi all,

My a2dConvert8bit function should be giving me a value of 30 according to the output voltage and sharp IR documentation.

The function is actually giving me 120, any ideas?

Mike
Title: Re: a2dConvert8bit returning wrong values
Post by: airman00 on February 16, 2008, 11:40:42 PM
is it giving you the same value all the time, regardless of distance?

also, did you set up the analog ports and inputs properly?
Title: Re: a2dConvert8bit returning wrong values
Post by: silo_xtreme on February 17, 2008, 09:50:06 AM
Ok, I've been checking this.

Looks like i'm expecting to get 30 (aka 30cm) because the volt meter says my Sharp IR is outputting 2V.  (I measured it).

However, when I get the value back from a2dConvert8bit , it's ~ 120 (it does change) +/- 2

Does this have something to do with my Reference?  I'm a little confused.   ???
Title: Re: a2dConvert8bit returning wrong values?????
Post by: silo_xtreme on February 17, 2008, 10:53:42 AM
Still thinking about this one....

Perhaps what I am getting back is my 2V as a number between 0-255 ?  Even with that assumption, i'm not sure I'm getting the right values.....

am i missing an equation or table lookup for the Sharp IR?
Title: Re: a2dConvert8bit returning wrong values
Post by: silo_xtreme on February 17, 2008, 11:44:23 AM
Hi again,

My N00b brain is still learning, and I read this article:

http://en.wikipedia.org/wiki/Analog-to-digital_converter

Now, I realized that the SOR code for the $50 robot does "obstacle detection";  silly me was thinking that I should be getting back values for distance.

If I wanted distance values I would probably make a look up table and compute it.  right?  ;)

Title: Re: a2dConvert8bit returning wrong values
Post by: Admin on February 18, 2008, 09:37:15 AM
Quote
If I wanted distance values I would probably make a look up table and compute it.  right?
yeap :P
(airman00 asked the exact same questions I would have)