make a TimeRunIntake command
authorMeryem Esa <meresa14@gmail.com>
Wed, 16 Mar 2016 02:51:50 +0000 (19:51 -0700)
committerHarel Dor <hareldor@gmail.com>
Tue, 22 Mar 2016 23:02:00 +0000 (16:02 -0700)
src/org/usfirst/frc/team3501/robot/commands/intakearm/TimeRunIntake.java [new file with mode: 0755]

diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/TimeRunIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/TimeRunIntake.java
new file mode 100755 (executable)
index 0000000..109db89
--- /dev/null
@@ -0,0 +1,43 @@
+package org.usfirst.frc.team3501.robot.commands.intakearm;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.Timer;
+import edu.wpi.first.wpilibj.command.Command;
+
+/**
+ *
+ */
+public class TimeRunIntake extends Command {
+  Timer timer;
+  private double time;
+
+  public TimeRunIntake(double time) {
+    timer = new Timer();
+    this.time = time;
+  }
+
+  @Override
+  protected void initialize() {
+    timer.start();
+    Robot.intakeArm.intakeBall();
+  }
+
+  @Override
+  protected void execute() {
+  }
+
+  @Override
+  protected boolean isFinished() {
+    return timer.get() >= time;
+  }
+
+  @Override
+  protected void end() {
+  }
+
+  @Override
+  protected void interrupted() {
+    end();
+  }
+}