Thread: Motor Code Help
View Single Post
  #2   Spotlight this post!  
Unread 14-02-2010, 18:04
odel's Avatar
odel odel is offline
Registered User
FRC #2990 (Hotwire Robotics)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Oregon
Posts: 8
odel is an unknown quantity at this point
Send a message via Yahoo to odel
Re: Motor Code Help

So this is what I have right now, we plugged the left motors into pwm 1 and the right ones into pwm 2 using pwm splitter, and still no luck

Code:
#include "WPILib.h"

class RobotDemo : public SimpleRobot
{
	RobotDrive robotDrive;
	Joystick stick1, stick2;

public:
	RobotDemo(void):
		robotDrive(1,2),	
		stick1(1),		//Joystick 1 in slot 1
		stick2(2)		//Joystick 2 in slot 2
	{
		GetWatchdog().SetExpiration(0.1);
	}

	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		robotDrive.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 						//    for 2 seconds
		robotDrive.Drive(0.0, 0.0); 	// stop robot
	}

	void OperatorControl(void)
	{
		GetWatchdog().SetEnabled(true);
		while (IsOperatorControl())
		{
			GetWatchdog().Feed();
			robotDrive.TankDrive(stick1,stick2);
			Wait(0.005);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
__________________
Reply With Quote