Go to Post A programmer's job is to write documentation that happens to compile.... :) - buddy.smith [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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
  #6   Spotlight this post!  
Unread 14-02-2010, 15:18
buddyb's Avatar
buddyb buddyb is offline
Registered User
FRC #1885 (ILITE)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2008
Location: Haymarket, VA
Posts: 65
buddyb has a spectacular aura aboutbuddyb has a spectacular aura aboutbuddyb has a spectacular aura about
Re: Motor Code Help

Quote:
Originally Posted by odel View Post
So now I have:
<CODE>
I need help declaring the Jaguars now
This *should* work. Change the values under RobotDemo(void): to change the slots.
Code:
#include "WPILib.h"

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

public:
	RobotDemo(void):
		robotDrive(1,				//Front Left motor port
				2,	//Back left motor port
				3,	//Front right motor port
				4),	//Back right motor port
		stick1(1),		//Joystick 1 in slot 1
		stick2(2)		//Joystick 2 in slot 2
	{
		GetWatchdog().SetExpiration(0.1);
	}

	/**
	 * Drive left & right motors for 2 seconds then stop
	 */
	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
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	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);
If it works, yay! If not, play around with the ports, and make sure everything's wired correctly. If all of that is correct, I probably did something stupid. XD
__________________
FRC - Team 1885 - Programmer.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
4 motor Mecanum wheel code request inventor1254 NI LabVIEW 17 23-02-2010 08:45
ADC code effecting motor outs??? Kyveck Programming 16 28-03-2006 15:12
Adding a motor to code sirbleedsalot Programming 1 27-01-2005 23:02
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 13:35.

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