Quote:
|
Originally Posted by magical hands
|
The solution I came up with is to make a simple counter that keeps track of program loops and moves the servo until it finds a color.
Code:
int counter = 0; //counter variable
if(camera_find_color(GREEN) == 0)
{
camera_set_servos(counter, 127); //move pan servo 1 PWM value 40 times a second
}
else camera_auto_servo(1); //stop pan loop
//Increment counter.
if(counter < 255)
{
counter++;
}
else counter = 0;