add comments for noobs who need help evan/limitswitch
authorEvanYap <evanyap.14@gmail.com>
Tue, 17 Nov 2015 04:14:53 +0000 (20:14 -0800)
committerEvanYap <evanyap.14@gmail.com>
Tue, 17 Nov 2015 04:14:53 +0000 (20:14 -0800)
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java [new file with mode: 0644]
src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java [deleted file]
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java

diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java
new file mode 100644 (file)
index 0000000..6080ade
--- /dev/null
@@ -0,0 +1,33 @@
+package org.usfirst.frc3501.RiceCatRobot.commands;
+
+import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class MoveArmTillSwitchHit extends Command {
+       Arm arm; //declares the arm object to reference some methods
+       double slowSpeed = 0.2; //Slow speed to reach a limit switch
+       
+       public MoveArmTillSwitchHit(double leveldesired) {
+               arm.setArmSpeeds(slowSpeed); //Moves the arm to a certain slow speed
+       }
+
+    protected void initialize() {
+        arm.initializeCounter();
+    }
+
+    protected void execute() {
+    }
+
+    protected boolean isFinished() {
+        return arm.isSwitchHit();
+    }
+
+    protected void end() {
+        arm.stop(); //stops arm once limit switch hit
+    }
+
+    protected void interrupted() {
+        end();
+    }
+}
diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java
deleted file mode 100644 (file)
index a3b77ac..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.usfirst.frc3501.RiceCatRobot.commands;
-
-import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-public class MoveArmToLevel extends Command {
-       Arm arm;
-       double slowSpeed = 0.2; //Slow speed to reach a limit switch
-       
-       public MoveArmToLevel(double leveldesired) {
-               arm.setArmSpeeds(slowSpeed); //Moves the arm to a certain slow speed
-       }
-
-    protected void initialize() {
-        arm.initializeCounter();
-    }
-
-    protected void execute() {
-    }
-
-    protected boolean isFinished() {
-        return arm.isSwitchHit();
-    }
-
-    protected void end() {
-        arm.stop(); //stops arm once limit switch hit
-    }
-
-    protected void interrupted() {
-        end();
-    }
-}
index 50322e52d091cf061077d82eb31cbae2d57d85d0..947d1659eeb799b613796087e13a2dd1f0039bd6 100644 (file)
@@ -22,11 +22,11 @@ public class Arm extends Subsystem {
   }
   
   public boolean isSwitchHit() {
-      return counter.get() > 0;
-  }
+      return counter.get() > 0; //detects if switch is hit
+  } 
   
   public void initializeCounter() {
-      counter.reset();
+      counter.reset(); //resets the counter back to 0
   }
 
   public void fineTuneControl(double d) {