Well, it's not really important for me knowing the degrees. From what I understood from you, the output is the current PWM of the tilt\pan servo?
If it is like that, please tell me if this code is ok:
Code:
//This program makes the robot drive after the target that is being targeted by
//the CMU camera. When the robot is close enough, it stops.
#define CLOSE_TO (a range between 0-255 [PWM])
unsigned char tilt;
unsigned char pan;
while(1)
{
CaptureTrackingData(0, 0, 0, 0, 0, 0, 0, 0, &pan, &tilt);
while(tilt<127)//PWM #127 means center of servo in easyC
{
Drive(40,255); //makes the robot turn left (function I made)
CaptureTrackingData(0, 0, 0, 0, 0, 0, 0, 0, &pan, &tilt);
}
while(tilt>127)//PWM #127 means center of servo in easyC
{
Drive(255,40); //makes the robot turn right (function I made)
CaptureTrackingData(0, 0, 0, 0, 0, 0, 0, 0, &pan, &tilt);
}
if(tilt==0)
{
Drive(0,255); //makes the robot drive forward
}
if(pan>=CLOSE_TO) //if the pan is close
{
stop(); //a function I made that stops the robot
return; //gets out of the function
}
}
Oh, and another question: in this year's FRC the robot could see multiple targets (seeing 2 green lights on the rack) so it can confuse the robot, so can you give me some ideas on how to make the robot ignore one of the lights?
Sorry for the multiple questions, I'm a rookie in a rookie team.