View Single Post
  #7   Spotlight this post!  
Unread 04-04-2007, 01:48
#root:'s Avatar
#root: #root: is offline
Registered User
FRC #1622 (Team Spyder)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2006
Location: Poway, CA
Posts: 3
#root: is an unknown quantity at this point
Thumbs down Re: Servo Values to Degrees... How?

Hey, I've been having a problem setting the correct degrees to a variable, even though it prints to the terminal correctly.

pan_angle = (((int)PAN_SERVO - 124) * 65)/124;
tilt_angle = (((int)TILT_SERVO - 144) * 25)/50;

I have tried making these variables ints, floats, and doubles (they are global static declared in user_routines.h, set in terminal.c, and used in user_routines_fast.c). Would it help if I cast pan_angle and tilt_angle as ints or changed 124 to 124.0? Maybe if I did

(int) pan_angle = (int) (((int)PAN_SERVO - 124) * 0.5242);

Any help would be appreciated. Thanks!