sensor sweep code help
Special_K
Posts: 162
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
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
Here's a better formatted version.· Note when you mix "GOSUB" and "GOTO", you must be really careful...