i am just going to post what i have mabye someone can tell me haow i would do this without stopping my entire program. This is my first year programming for first and i have promised my team some nice "features". any help would be greatly appreciated
Code:
if (p1_sw_trig == 1)
{
Switch1_LED = 1 // aiming light turns on when aiming
locked = 0
while (locked == 0)
{
if (PAN_SERVO > PAN_CENTER_PWM_DEFAULT + 20)
{
pwm01 = 127 + aim_gain
pwm02 = 127 + aim_gain
}
else if (PAN_SERVO < PAN_CENTER_PWM_DEFAULT - 20)
{
pwm01 = 127 - aim_gain
pwm02 = 127 - aim_gain
}
else if (PAN_SERVO < PAN_CENTER_PWM_DEFAULT + 21 & PAN_SERVO > PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 127 + aim_soft_gain
pwm02 = 127 + aim_soft_gain
}
else if (PAN_SERVO > PAN_CENTER_PWM_DEFAULT - 21 & PAN_SERVO < PAN_CENTER_PWM_DEFAULT)
{
pwm01 = 127 - aim_soft_gain
pwm02 = 127 - aim_soft_gain
}
else
{
Switch1_LED = 0 // really cool light scrolling that i had to put somewhere in the code
Switch2_LED = 0
Switch3_LED = 0
Switch1_LED = 1
Switch1_LED = 0
Switch2_LED = 1
Switch2_LED = 0
Switch3_LED = 1
Switch3_LED = 0
Switch2_LED = 1
Switch2_LED = 0
Switch1_LED = 1
Switch1_LED = 0
printf("\TARGET ACQUIRED");
locked = 1
}
}
}