View Single Post
  #1   Spotlight this post!  
Unread 04-02-2013, 16:40
MI6 MI6 is offline
Registered User
FRC #4362
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: United States
Posts: 6
MI6 is an unknown quantity at this point
Toggle Speed adjustment Help

I'm just tank drive with a Xbox controller, i want to make it so when i press one of the two triggers it will make a limit the speed of the robot.

My code :
Quote:
#include "WPILib.h"

class DemoRobot : public SimpleRobot
{
RobotDrive drivetrain;
Joystick xbox;
public:
DemoRobot() :
drivetrain(1, 2), xbox(1)
{
GetWatchdog().SetEnabled(false);
}

void Autonomous() {}

void OperatorControl()
{
while (IsOperatorControl()) {
drivetrain.TankDrive(xbox.GetY(), xbox.GetRawAxis(5));
Wait(0.005);
}
}
};

START_ROBOT_CLASS(DemoRobot);
Reply With Quote