The SetServoTracking command is the same as SetPWM but for the camera servos. If you want to have the camera auto target like it would if the servos were plugged into the camera then do this.
Code:
void Initialize ( void )
{
InitCamera ( 1 ) ; //Initialize camera for target color
SetServoTracking ( 1 , 1 ) ; // Sets camera servos to autotrack target
StartCamera ( ) ; // You need to restart the camera if you change camera servo settings
}
void OperatorControl ( void )
{
unsigned char ServoPan;
unsigned char ServoTilt;
SetServoTracking ( 1 , 1 ) ; // Sets camera servos to autotrack target
StartCamera ( ) ; // You need to restart the camera if you change camera servo settings
while ( 1 )
{
// Checks the where the camera wants the servos to be pointed.
CaptureTrackingData ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , &ServoPan , &ServoTilt ) ;
SetPWM ( 1 , ServoPan ) ; // Moves the servo for Pan
SetPWM ( 2 , ServoTilt ) ; // Moves the servo for Tilt
}
}