Is possible to look at the source behind the library functions supplied with Easy C Pro for FIRST? For instance can we download the source to the Arcade drive function to see how it is actually coded?
Thanks,
Bob Potterveld
Is possible to look at the source behind the library functions supplied with Easy C Pro for FIRST? For instance can we download the source to the Arcade drive function to see how it is actually coded?
Thanks,
Bob Potterveld
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:
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.
Thanks for the post Brad. We are worried about overdriving our motor and might need to be able to adjust how this function works for some of the extremes during operator control.
Bob Potterveld