add multiple diff buttons to save values into diff indexes of potentiometer array... danny/reviewed/cindy/intakeArmTesting
authorCindy Zhang <cindyzyx9@gmail.com>
Wed, 17 Feb 2016 00:01:11 +0000 (16:01 -0800)
committerCindy Zhang <cindyzyx9@gmail.com>
Wed, 17 Feb 2016 00:59:44 +0000 (16:59 -0800)
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/commands/intakearm/RecordPotAngle.java

index c2a09d209d6aee45ed212f56368396f3863f4d95..dbd67d942a3082ef826ef86a744dfb333ca98daa 100644 (file)
@@ -10,7 +10,10 @@ public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
 
-  public static Button recordPotAngle;
+  public static Button recordPotAngle1;
+  public static Button recordPotAngle2;
+  public static Button recordPotAngle3;
+  public static Button recordPotAngle4;
 
   // // first column of arcade buttons - getting past defenses
   // public static DigitalButton passPortcullis;
@@ -43,9 +46,14 @@ public class OI {
     leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
     rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
 
-    recordPotAngle = new JoystickButton(leftJoystick,
-        Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT);
-    recordPotAngle.whenPressed(new RecordPotAngle());
+    recordPotAngle1 = new JoystickButton(leftJoystick, 4);
+    recordPotAngle1.whenPressed(new RecordPotAngle(0));
+    recordPotAngle2 = new JoystickButton(leftJoystick, 3);
+    recordPotAngle2.whenPressed(new RecordPotAngle(1));
+    recordPotAngle3 = new JoystickButton(leftJoystick, 5);
+    recordPotAngle3.whenPressed(new RecordPotAngle(2));
+    recordPotAngle4 = new JoystickButton(leftJoystick, 2);
+    recordPotAngle4.whenPressed(new RecordPotAngle(3));
 
     // passPortcullis = new DigitalButton(
     // new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT));
index bb9a01208457c11e654a2d87040573f06af86b57..589bcb7358f1ad601b7304f633bc2c2601e52def 100644 (file)
@@ -9,14 +9,17 @@ import edu.wpi.first.wpilibj.command.Command;
  */
 public class RecordPotAngle extends Command {
 
-  public RecordPotAngle() {
+  private static int index;
+
+  public RecordPotAngle(int index) {
     requires(Robot.intakeArm);
+    this.index = index;
   }
 
   // Called just before this Command runs the first time
   @Override
   protected void initialize() {
-    Robot.intakeArm.potAngles[0] = Robot.intakeArm.getArmAngle();
+    Robot.intakeArm.potAngles[index] = Robot.intakeArm.getArmAngle();
   }
 
   // Called repeatedly when this Command is scheduled to run
@@ -27,7 +30,7 @@ public class RecordPotAngle extends Command {
   // Make this return true when this Command no longer needs to run execute()
   @Override
   protected boolean isFinished() {
-    return false;
+    return true;
   }
 
   // Called once after isFinished returns true