View Single Post
  #1   Spotlight this post!  
Unread 07-02-2009, 09:27
Chief Pride's Avatar
Chief Pride Chief Pride is offline
<3
AKA: James Kiefer
no team
 
Join Date: Sep 2007
Rookie Year: 2007
Location: Kalamazoo, MI
Posts: 653
Chief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond reputeChief Pride has a reputation beyond repute
Passing a motor as an argument in a function

Hello, I am trying to pass a speed controller (victor) as an BYREF argument in a function and set its value, however, the motor wont turn on and I get no errors. Here is what it looks like:

Code:
void SpecialControl(SpeedController &Motor); /* prototype */
class Robot : public SimpleRobot
{
	Victor InitialMotor;
	public:
		Robot(void):		// these must be initialized in the same order 
		InitialMotor(1)
	{
		GetWatchdog().SetExpiration(0.1);
	}



void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		SpecialControl(InitialMotor);
	}
};

void SpecialControl(SpeedController &Motor)
{
	Motor.Set(1);
}
Thanks in advance.
Reply With Quote