We planned to set up joystick buttons to make the kicker move to a set position using potentiometers, but it keeps overshooting and getting stuck. Here's what we have:
Code:
if(rightstick->GetRawButton(HIGH_POT_BTN))
{
while(kickerValue != HIGH_POT)
{
GetWatchdog().Feed();
if(kickerValue>HIGH_POT)
winch->Set(Relay::kForward);
else
winch->Set(Relay::kReverse);
}
else
winch->Set(Relay::kOff);
}
We tried using if instead of while because of watchdog problems, but that would only work by holding the button down. Now, the kicker pulls back too far and gets stuck. Does anyone know if it's a problem in the code or in the numbers we used for the pots?