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!
|