View Single Post
  #2   Spotlight this post!  
Unread 10-02-2007, 20:38
Ianuser Ianuser is offline
Registered User
FRC #0570
 
Join Date: Feb 2007
Location: new york
Posts: 64
Ianuser is an unknown quantity at this point
Re: Servo Values to Degrees... How?

So, wait a minute. I wrote this:
unsigned float Find_Distance(void)
{
float radian;
float range;
radian = ((((angle I will measure in degrees that the tilt servo has to offer from down to up) / 256) * pi) / 180) * pwm07(which is my tilt_servo pwm);
range = (116 - (distance I have yet to measure between the floor and my camera because we haven't placed it yet)) / tan(radian);
}

I read on another thread that the angle has to be in radians for the Tan() function to take in. Also, I put this in Tracking.c. Does it matter where I place this function? SO, my real questions are, Does anything about what I wrote make sense? And how does this compare to the:
pan angle = ((current pan PWM) - (pan center PWM)) * degrees/pan PWM step that was stated earlier in this thread (other than I'm looking for tilt rather than pan) Do I have to subtract my pwm07 by 124 like you did in this one? Sorry if I'm being confusing, but I'm trying to understand all of this at once. I also have questions about why my camera doesn't work PERIOD. It's all hooked up but it seems to not be getting power. Anyway, one thing at a time. Please help me if you can! Thanks

Last edited by Ianuser : 10-02-2007 at 20:41.