From: Kevin Zhang Date: Sat, 23 Jan 2016 03:00:02 +0000 (-0800) Subject: Add button handling for shooter commands X-Git-Url: http://challenge-bot.com/repos/?p=3501%2Fstronghold-2016;a=commitdiff_plain;h=37e5a1215ef4909e720304e619667d40492dfaf1 Add button handling for shooter commands --- diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 5322f362..17889c70 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -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; @@ -18,15 +21,18 @@ public class OI { decrementShooterSpeed = new JoystickButton(rightJoystick, Constants.OI.DEC_SHOOTER_SPD_PORT); + decrementShooterSpeed.whenPressed(new ChangeShooterSpeed(-0.1)); incrementShooterSpeed = new JoystickButton(rightJoystick, Constants.OI.INC_SHOOTER_SPD_PORT); + incrementShooterSpeed.whenPressed(new ChangeShooterSpeed(0.1)); outputCurrentShooterSpeed = new JoystickButton(rightJoystick, Constants.OI.SHOOT_PORT); trigger = new JoystickButton(rightJoystick, Constants.OI.TRIGGER_PORT); + trigger.whenPressed(new SetShooterSpeed(0.5)); + trigger.whenReleased(new SetShooterSpeed(0.0)); } - }