View Single Post
  #2   Spotlight this post!  
Unread 05-02-2007, 10:16
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 591
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Source code for the Easy C Pro library functions?

Quote:
Originally Posted by Kingofl337 View Post
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.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute