Set buttons in OI to run changeSpeed command when pressed
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.changeSpeed;
4
5 import edu.wpi.first.wpilibj.Joystick;
6 import edu.wpi.first.wpilibj.buttons.Button;
7 import edu.wpi.first.wpilibj.buttons.JoystickButton;
8
9 public class OI {
10 public static Joystick leftJoystick;
11 public static Joystick rightJoystick;
12 public static Button decrementSpeed;
13 public static Button incrementSpeed;
14 public static Button outputCurrentShooterSpeed;
15 public static Button runWheel;
16
17 public OI() {
18 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
19 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
20
21 decrementSpeed = new JoystickButton(rightJoystick,
22 Constants.OI.DECREMENT_SHOOTER_PORT);
23
24 incrementSpeed = new JoystickButton(rightJoystick,
25 Constants.OI.INCREMENT_SHOOTER_PORT);
26
27 outputCurrentShooterSpeed = new JoystickButton(rightJoystick,
28 Constants.OI.SHOOTER_PORT);
29
30 runWheel = new JoystickButton(rightJoystick, Constants.OI.TRIGGER_PORT);
31
32 incrementSpeed.whenPressed(new changeSpeed(0.1));
33
34 decrementSpeed.whenPressed(new changeSpeed(-0.1));
35
36 }
37
38 }