Re: Need help with programmimg an IR seeker
First of all, you didn't include the whole program, there are no #pragma lines in here. Next time, make sure you put them in too. Second, make sure you surround your code with [ code] [/ code] tags (without the spaces). It will make your code much more readable.
There is nowhere in your robot where you tell it to stop when you're a certain distance away from the object. I have a few questions for you, and you really need to think about them:
* What happens when the object is straight in front (5).
* What happens when the object is to the left (ir seeker returns 1 or 9, depending on how the sensor is mounted)
* What happens when it's a little bit to the right (ir seeker returns 3 or 7, depending on how the sensor is mounted)
To be able to successfully use a sensor, it is important that you understand its behaviour. Reread the page here, especially the introduction part: http://www.hitechnic.com/cgi-bin/commer ... ey=NSK1042
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page