Go to Post Since you have to undo all the connections anyway in order to swap them, you might as well take advantage of the opportunity to do some simple and straightforward troubleshooting. - Alan Anderson [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 12-03-2012, 22:20
KeyFalcon KeyFalcon is offline
Registered User
FRC #4185 (Fanastic Falcons)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Fairfield
Posts: 5
KeyFalcon is an unknown quantity at this point
Joystick Trigger and Button C++ Programming

Hello. I am on a Rookie team and I am a Rookie programmer. I have no idea how to program the buttons on the joystick. I just need help programming the buttons for our robot's shooter motor and intake motor. Any help would be appreciated.

Thank you!
Code:
/**
 * 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
{
	Victor (victora);
	Victor (victorb);
	Victor (victorc);
	Victor (victord);
	RobotDrive myRobot; // robot drive system
    Joystick rightstick;
    
 public:
	RobotDemo(void):
		victora (1),
		victorb (2),
		victorc (3),
		victord (4),
		myRobot(victora,victorb,victorc,victord),	// these must be initialized in the same order
		rightstick(2)		// as they are declared above.
	    
	{
		myRobot.SetExpiration(0.1);
	}

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

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl())
		{
			myRobot.ArcadeDrive(rightstick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 16:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi