Society of Robots - Robot Forum
Software => Software => Topic started 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
-
is it giving you the same value all the time, regardless of distance?
also, did you set up the analog ports and inputs properly?
-
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. ???
-
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?
-
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? ;)
-
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)