Shop OBEX P1 Docs P2 Docs Learn Events
sensor sweep code help — Parallax Forums

sensor sweep code help

Special_KSpecial_K Posts: 162
edited 2006-09-16 20:56 in BASIC Stamp
have a slight problem. I have several sensors that are taking a scan of the area ahead of my robot. The sonar three IR.
the last sensor variable (sensor) in the last if statement returns a 0
I made this if then statement loop because the sensors fired to slowly. Each time one of the 3 GP2D02 fired the robot would have to wait till the value was returned then the next GP2D02 fired and then next (the GP2D02 takes 50 MS to return the sensor data.) Then the sonar's can begin to fire, so I decided to fire the GP2D02 at once and read the input pins. It is so much faster but I am still missing the ability to read the center GP2D02 (return 0 in the debug). I know it must me some stupid mistake. Need a fresh set of eyes.
here is the code can anyone see any problem with it

Post Edited (Special_K) : 9/16/2006 5:30:44 AM GMT

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-16 20:56
    I don't know enough about the GP2D02, but 50 mSec seems like a LONG time to read it. The 'ping' sensor maxes out at around 20 mSec.

    Here's a better formatted version.· Note when you mix "GOSUB" and "GOTO", you must be really careful...
Sign In or Register to comment.