Skip to content

Commit

Permalink
Added code to toggle squared inputs with the Y button.
Browse files Browse the repository at this point in the history
  • Loading branch information
floogulinc committed Jan 24, 2014
1 parent d32e738 commit c1dae4a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/com/frc2879/bender/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Robot extends SimpleRobot {
Joystick joystick = new Joystick(1);

public final String name = "Bender Bot";
public final String version = "v1.04";
public final String version = "v1.05";
public final String fullname = name + " " + version;

// Defining Joystick Mappings:
Expand Down Expand Up @@ -56,15 +56,23 @@ protected void robotInit() {
dsout = new DSOutput();
dsout.say(1, fullname);
saysticksensitivity();
saysquaredinputs();
}

boolean pbuttonRB = false;
boolean pbuttonLB = false;
boolean pbuttonY = false;



public void saysticksensitivity() {
dsout.clearLine(2);
dsout.say(2, "Sensitivity: " + Integer.toString(StickSensitivity));
}
public void saysquaredinputs() {
dsout.clearLine(3);
dsout.say(3, "Squared Inputs: " + SquaredInputs);
}

/**
* This function is called once each time the robot enters autonomous mode.
Expand All @@ -83,7 +91,7 @@ public void operatorControl() {
// Update joystick values:
double moveL = ((joystick.getRawAxis(Stick_LEFT_Y)) * ((double) (StickSensitivity) / 100));
double spinL = ((joystick.getRawAxis(Stick_LEFT_X)) * ((double) (StickSensitivity) / 100));

if (joystick.getRawButton(Button_RIGHT_BUMPER)) {
pbuttonRB = true;
} else if (pbuttonRB && !joystick.getRawButton(Button_RIGHT_BUMPER)) {
Expand All @@ -99,10 +107,20 @@ public void operatorControl() {
saysticksensitivity();
pbuttonLB = false;
}

if (joystick.getRawButton(Button_Y)) {
pbuttonY = true;
} else if (pbuttonY && !joystick.getRawButton(Button_Y)) {
SquaredInputs = !SquaredInputs;
saysquaredinputs();
pbuttonY = false;
}


// Drive da robot:
drivetrain.arcadeDrive(moveL, spinL, SquaredInputs);


Timer.delay(0.01);
}
}
Expand Down

0 comments on commit c1dae4a

Please sign in to comment.