View Single Post
  #2   Spotlight this post!  
Unread 02-02-2005, 16:26
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: AUTO TRACKING!!!!!!:(

Quote:
Originally Posted by magical hands
Hi! We got our cam working and it detects different colours too. Problem is we have to put the colour in front of the cam in order for cam to recognize the colour. Our cam doesn't spin on servos looking for the object we have to spoon feed it! Anyone knows why this is happening or any ideas? Please post thanks!

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;