View Single Post
  #5   Spotlight this post!  
Unread 27-01-2012, 12:48
njd231 njd231 is offline
Programmer/Electrician
FRC #4094 (Mars Bandit)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Georgia
Posts: 14
njd231 is an unknown quantity at this point
Re: Jaguar keeps flashing

i re-wrote the cod (with the jaguars enabled), but it still isn't working. Any ideas?
Code:
#include "WPILib.h"

/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Joystick stick; // create joystick 1
	Joystick stick2;//create joystick 2
	Jaguar motor1;//create motor1
	Jaguar motor2;//create motor2

public:
	RobotDemo(void):
		myRobot(1, 2),	// these must be initialized in the same order (activate pwm 1 and pwm 2)
		stick(1),		// as they are declared above. (activate joystick 1)
		stick2(2),	// activate joystick 2
		motor1(1,1), //activate motor 1(digital output 1)
		motor2(1,2) //activate motor2(Digital output 1)
		
	{
		myRobot.SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	void Autonomous(void)
	{
		myRobot.Drive(0.5, 0.0); 	// drive forwards half speed
		Wait(2.0); 				//    for 2 seconds
		myRobot.Drive(0.0, 0.0); 	// stop robot
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		motor1.Get();
		motor2.Get();
		while (IsEnabled() && IsOperatorControl())
		{
			myRobot.SetSafetyEnabled(false);
			myRobot.TankDrive(stick,stick2); // drive with arcade style (use right stick)
			Wait(0.006);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote