# how do i calculate degree/pwmstep?

I know how to calculate the range, I think, but How do I calculate the degree/pwmStep?
I have now
PWM TO DEGREES 1.7647
TARGET HEIGHT 116
CAMERA HEIGHT 12.625

PWMINDEX
VALIUE DEGREES RADIANS TAN C RANGE STRING
1 1.7647 0.030799825 0.030809568 3355 3355,
2 3.5294 0.061599651 0.061677683 1676 1676,
3 5.2941 0.092399476 0.092663336 1116 1116,
4 7.0588 0.123199301 0.123826418 835 835,
5 8.8235 0.153999127 0.155228188 666 666,
6 10.5882 0.184798952 0.18693176 553 553,
7 12.3529 0.215598777 0.219002627 472 472,
8 14.1176 0.246398602 0.251509222 411 411,
9 15.8823 0.277198428 0.284523532 363 363,
10 17.647 0.307998253 0.318121771 325 325,
11 19.4117 0.338798078 0.352385134 293 293,
12 21.1764 0.369597904 0.387400647 267 267,
13 22.9411 0.400397729 0.423262122 244 244,
14 24.7058 0.431197554 0.460071261 225 225,
15 26.4705 0.46199738 0.497938912 208 208,
16 28.2352 0.492797205 0.536986543 193 193,
17 29.9999 0.52359703 0.577347942 179 179,
18 31.7646 0.554396856 0.61917123 167 167,
19 33.5293 0.585196681 0.662621224 156 156,
20 35.294 0.615996506 0.707882261 146 146,
21 37.0587 0.646796332 0.755161561 137 137,
22 38.8234 0.677596157 0.804693285 128 128,
23 40.5881 0.708395982 0.856743453 121 121,
24 42.3528 0.739195807 0.911615941 113 113,
25 44.1175 0.769995633 0.969659854 107 107,
26 45.8822 0.800795458 1.031278668 100 100,
27 47.6469 0.831595283 1.096941638 94 94,
28 49.4116 0.862395109 1.167198184 89 89,
29 51.1763 0.893194934 1.242696191 83 83,
30 52.941 0.923994759 1.324205527 78 78,
31 54.7057 0.954794585 1.412648617 73 73,
32 56.4704 0.98559441 1.509140656 68 68,
33 58.2351 1.016394235 1.615043229 64 64,
34 59.9998 1.047194061 1.732036845 60 60,
35 61.7645 1.077993886 1.862220667 56 56,
36 63.5292 1.108793711 2.008252124 51 51,
37 65.2939 1.139593536 2.173546353 48 48,
38 67.0586 1.170393362 2.362567687 44 44,
39 68.8233 1.201193187 2.581266872 40 40,
40 70.588 1.231993012 2.837756758 36 36,
41 72.3527 1.262792838 3.143393401 33 33,
42 74.1174 1.293592663 3.514577863 29 29,
43 75.8821 1.324392488 3.975909337 26 26,
44 77.6468 1.355192314 4.566040876 23 23,
45 79.4115 1.385992139 5.349390677 19 19,
46 81.1762 1.416791964 6.44190641 16 16,
47 82.9409 1.44759179 8.0754744 13 13,
48 84.7056 1.478391615 10.79113984 10 10,
49 86.4703 1.50919144 16.21193838 6 6,
50 88.235 1.539991265 32.45192902 3 3,
51 89.9997 1.570791091 190985.9317 0 0,

Is this right? My MAXTILT is 194, MIN is 94, and CENTER is 144 with 50 pwmsteps for the 3 large steps for the camera. Please help me, my code doesnâ€™t work:

``````	//Robot Movement as per CAMERA:

if((Get_Tracking_State() == CAMERA_ON_TARGET) || (Get_Tracking_State() == TARGET_IN_VIEW))
{
pwm01_On_Off = 0;
pwm02_On_Off = 0;
Switch3_LED = 1;
if(PAN_SERVO > PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 180;
pwm02 = 74;

}
else if(PAN_SERVO < PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 74;
pwm02 = 180;
}
else
{
pwm01 = 180;
pwm02 = 180;
}
}
else
{
Switch3_LED = 0;
pwm01_On_Off = 1;
pwm02_On_Off = 1;
//printf("4"); //these statements are just to see if it worked
}
/*
if(Find_Distance() <= 50) //THIS DOESN"T WORK!! WHY NOT?
{
pwm01 = 127;
pwm02 = 127;
pwm01_On_Off = 1;
pwm02_On_Off = 1;
I_Want_To_Search = 0; //Stops calling Servo_Track(). THEN CALL ANOTHER THING
Switch3_LED = 0;
//printf("3"); //these statements are just to see if it worked
}
*/

if(p1_y > 129 || p2_y > 129)
{
pwm01_On_Off = 1;
pwm02_On_Off = 1;
I_Want_To_Search = 0;
}
else if(p1_y < 125 || p2_y < 125)
{
pwm01_On_Off = 1;
pwm02_On_Off = 1;
I_Want_To_Search = 0;
}
``````