Create toggle gear button and intialize it in constuctor
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
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 private static OI oi;
11 public static Joystick leftJoystick;
12 public static Joystick rightJoystick;
13 public static Button toggleWinch;
14
15 public static Button toggleIndexWheel;
16 public static Button toggleFlyWheel;
17
18 public static Button toggleGear;
19
20 public OI() {
21 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
22 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
23 toggleWinch = new JoystickButton(leftJoystick,
24 Constants.OI.TOGGLE_WINCH_PORT);
25 toggleIndexWheel = new JoystickButton(leftJoystick,
26 Constants.OI.TOGGLE_INDEXWHEEL_PORT);
27 toggleFlyWheel = new JoystickButton(leftJoystick,
28 Constants.OI.TOGGLE_FLYWHEEL_PORT);
29 toggleGear = new JoystickButton(leftJoystick,
30 Constants.OI.TOGGLE_GEAR_PORT);
31 toggleGear.whenPressed(new ToggleGear());
32 }
33
34 public static OI getOI() {
35 if (oi == null)
36 oi = new OI();
37 return oi;
38 }
39 }