OK, for the pwm steps, my MIN is 94, max is 194 and center is 144. its a 50º range, 25º from 94 to 144 and 25º from 144 to 194. So, shouldn't it then be 100/50? or what? Im still a bit confused.
ALSO, might this work for moving the robot toward the light?
Code:
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;
}
else if(PAN_SERVO < PAN_CENTER_PWM_DEFAULT)
{
pwm02 = 180;
}
else //see below for question
{
pwm01 = 180;
pwm02 = 180;
}
}
(pwm01_On_Off and pwm02_On_Off are just to map the joystick to the pwm. if 1, then joystick works, if its not 1 (usually 0), then joysticsk dont work and the motors can be set to specific speeds.)
How do I use error precent to manipulate how accurate ("//see below for question") this will be (when it is looking directly at the light)?