Add button handling for shooter commands
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
index 9a365a7c01e71a08c1ee19b9426c6b547ab1632a..17889c7073c21796465fa0294b3c3f057a7ec139 100644 (file)
@@ -1,5 +1,8 @@
 package org.usfirst.frc.team3501.robot;
 
+import org.usfirst.frc.team3501.robot.commands.ChangeShooterSpeed;
+import org.usfirst.frc.team3501.robot.commands.SetShooterSpeed;
+
 import edu.wpi.first.wpilibj.Joystick;
 import edu.wpi.first.wpilibj.buttons.Button;
 import edu.wpi.first.wpilibj.buttons.JoystickButton;
@@ -7,8 +10,8 @@ import edu.wpi.first.wpilibj.buttons.JoystickButton;
 public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
-  public static Button decrementSpeed;
-  public static Button incrementSpeed;
+  public static Button decrementShooterSpeed;
+  public static Button incrementShooterSpeed;
   public static Button outputCurrentShooterSpeed;
   public static Button trigger;
 
@@ -16,17 +19,20 @@ public class OI {
     leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
     rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
 
-    decrementSpeed = new JoystickButton(rightJoystick,
-        Constants.OI.DECREMENT_SHOOTER_PORT);
+    decrementShooterSpeed = new JoystickButton(rightJoystick,
+        Constants.OI.DEC_SHOOTER_SPD_PORT);
+    decrementShooterSpeed.whenPressed(new ChangeShooterSpeed(-0.1));
 
-    incrementSpeed = new JoystickButton(rightJoystick,
-        Constants.OI.INCREMENT_SHOOTER_PORT);
+    incrementShooterSpeed = new JoystickButton(rightJoystick,
+        Constants.OI.INC_SHOOTER_SPD_PORT);
+    incrementShooterSpeed.whenPressed(new ChangeShooterSpeed(0.1));
 
     outputCurrentShooterSpeed = new JoystickButton(rightJoystick,
-        Constants.OI.SHOOTER_PORT);
+        Constants.OI.SHOOT_PORT);
 
     trigger = new JoystickButton(rightJoystick, Constants.OI.TRIGGER_PORT);
+    trigger.whenPressed(new SetShooterSpeed(0.5));
+    trigger.whenReleased(new SetShooterSpeed(0.0));
 
   }
-
 }