Well the POT in an analog port will return 0 - 1024.
The code should explain the rest.
You probaly want to add a statement to make sure the number going into
the victor is between 0 and 255.
Code:
{
if ( Button1 == 1 )
{
Target = 200 ;
}
else if ( Button2 == 1 )
{
Target = 400 ;
}
else if ( Button3 == 1 )
{
Target = 600 ;
}
Arm_Out = GetAnalogInput ( 1 ) ; //GetAnalogInput(Port) Checks the Port and Return 0-1024
Error = (Current - Target) // Computes Error Based on How Far you are from the goal
Drive = ((Gain * Error)+127) // Based on the gain it outputs a number and then add 127 so the Victor Understands
SetPWM ( 1 , Drive ) ; // SetPWM(Port,Speed)
}