add claw toggle and winch tensioning
[3501/3501-spark-go] / src / org / usfirst / frc / team3501 / robot / Joystick.java
CommitLineData
b449387d
LH
1package org.usfirst.frc.team3501.robot;
2
3import java.util.HashMap;
4import java.util.stream.IntStream;
5
6import edu.wpi.first.wpilibj.buttons.JoystickButton;
7import edu.wpi.first.wpilibj.command.Command;
8
9public class Joystick extends edu.wpi.first.wpilibj.Joystick {
10
11 private HashMap<Integer, JoystickButton> buttons;
12
13 public Joystick(int port) {
14 super(port);
15
16 IntStream.rangeClosed(1, 12).forEach((b) -> {
17 buttons.put(b, new JoystickButton(this, b));
18 });
19 }
20
21 public void whenPressed(int button, Command c) {
22 buttons.get(button).whenPressed(c);
23 }
24
25 public void whenReleased(int button, Command c) {
26 buttons.get(button).whenReleased(c);
27 }
d24e8611
LH
28
29 public void whileHeld(int button, Command c) {
30 buttons.get(button).whileHeld(c);
31 }
b449387d 32}