Quote:
Originally Posted by DustinB_3
Thanks for the whitepaper
I think I understand fairly well, would this work:
int Target;
int Error;
int Gain = 0.5;
int Drive;
int Arm_Out;
if ( p1_sw_trig == 1 )
{
Target = 600 ;
}
else if ( p2_sw_trig == 1 )
{
Target = 1000 ;
}
else if ( p3_sw_trig == 1 )
{
Target = 1600 ;
}
Arm_Out = Get_ADC_Result(2); //GetAnalogInput(Port) Checks the Port and Return 0-1024
Error = (Arm_Out - 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
pwm01 = Drive;
|
The analog inputs on the RC vary from 0 to 1024.
A target of 1600 would cause the arm motor to continue to run indefinately.
[EDIT]
This depends on what line you have defined in Kevin's code.
[/EDIT]