View Single Post
  #11   Spotlight this post!  
Unread 15-02-2006, 13:53
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
Re: Camera isn't working

If I had pasted the exact code I used, it would have confused you more

See, you don't need that giant if block. As the code tells the servo to move closer and closer to the center of the target, the value of PAN_SERVO decreases more and more, until it reaches 127. So if you left it alone, it would slow down as it reached the center for you.

Depending on your turret design, the code that I gave would have turned back and forth over and over trying to line itself up correctly. It may have worked how it was, it depends on your robot design.

The tilt code is going to be very, very similar to the pan code.

You may need to add some limit switches, mechanical stops, or both to prevent the turret from spinning too far.