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 :
#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);