From: Cindy Zhang Date: Wed, 17 Feb 2016 00:01:11 +0000 (-0800) Subject: add multiple diff buttons to save values into diff indexes of potentiometer array... X-Git-Url: http://challenge-bot.com/repos/?p=3501%2Fstronghold-2016;a=commitdiff_plain;h=7ccd0b7a837b9bee50676d9c0264ec97aea459db add multiple diff buttons to save values into diff indexes of potentiometer array of angles --- diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RecordPotAngle.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RecordPotAngle.java index bb9a0120..589bcb73 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RecordPotAngle.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RecordPotAngle.java @@ -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