View Single Post
  #2   Spotlight this post!  
Unread 09-02-2009, 01:07
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Passing a motor as an argument in a function

Give this a shot:
Code:
void SpecialControl(SpeedController *Motor); /* prototype */
class Robot : public SimpleRobot
{
	Victor *InitialMotor;
	public:
		Robot(void)
	        {
                       InitialMotor = new Victor(1);
		       GetWatchdog().SetExpiration(0.1);
	        }


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

void SpecialControl(SpeedController *Motor)
{
	Motor->Set(1);
}
__________________


Which badges can you claim?
Reply With Quote