Quote:
Originally Posted by Kingofl337
I'm sorry but the complete source isn't available. But, most of the functions are pretty strait forward. Brad can also post bits of code if he wants.
|
The 2 motor arcade code looks like this:
Code:
void Arcade2(unsigned char movePort, unsigned char moveChannel,
unsigned char rotatePort, unsigned char rotateChannel,
unsigned char leftMotor, unsigned char rightMotor,
unsigned char leftInvert, unsigned char rightInvert)
{
int moveValue, rotateValue;
int leftMotorValue, rightMotorValue;
moveValue = ((int)GetOIAInput(movePort, moveChannel)) - 127;
rotateValue = ((int)GetOIAInput(rotatePort, rotateChannel)) - 127;
rightMotorValue = moveValue + rotateValue;
leftMotorValue = rotateValue - moveValue;
if (leftInvert) leftMotorValue = - leftMotorValue;
if (rightInvert) rightMotorValue = - rightMotorValue;
SetPWM(leftMotor, pwmLimit(leftMotorValue + 127));
SetPWM(rightMotor, pwmLimit(rightMotorValue + 127));
}
If you were interested because of wanting to make some changes, you can simply include your own version of this function in your easyC or WPILib program and it will be used instead of the library routine. That's the nice thing about libraries - your project code takes precedence.