make naive method for updating currentLevel/ check values of limit switches
[3501/2015-FRC-Spark] / src / org / usfirst / frc3501 / RiceCatRobot / subsystems / Arm.java
index 3a69eea7fd4cb6ab3e9fa2d33fd4ffb909f60faf..e584153a0e30506f34d0ee2f469d611d9f4f8808 100644 (file)
@@ -10,9 +10,10 @@ import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Arm extends Subsystem {
   private CANJaguar left, right;
-  ArrayList<DigitalInput> limitSwitches;
+  private ArrayList<DigitalInput> limitSwitches;
   //channel index numbers correspond to limit switches
-  int[] channels;
+  private int[] channels;
+  private int currentLevel;
   private final int NUM_OF_SWITCHES = 4;
 
   public Arm() {
@@ -68,6 +69,16 @@ public class Arm extends Subsystem {
     right.set(0);
   }
   
+  //should run in robot.java teleop periodic (autonomous periodic too maybe?)
+  public void updateLimitSwitches(){
+         for(int i = 0; i < NUM_OF_SWITCHES; i ++){
+                 DigitalInput d = limitSwitches.get(i);
+                 if(d.get()){
+                         currentLevel = i;
+                 }
+         }
+  }
+  
   public int getLevel(){
          //return last past switch 
          return 0;