add limit switch objects to arm subsystem
authorKevin Zhang <kevin.zhang.13499@gmail.com>
Tue, 17 Nov 2015 05:01:11 +0000 (21:01 -0800)
committerKevin Zhang <kevin.zhang.13499@gmail.com>
Tue, 17 Nov 2015 05:01:11 +0000 (21:01 -0800)
src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java

index 8d78c8f48e9e8ccac467c6617c1cc3368cb38eba..3a69eea7fd4cb6ab3e9fa2d33fd4ffb909f60faf 100644 (file)
@@ -1,16 +1,39 @@
-package org.usfirst.frc3501.RiceCatRobot.subsystems;
+       package org.usfirst.frc3501.RiceCatRobot.subsystems;
+
+import java.util.ArrayList;
 
 import org.usfirst.frc3501.RiceCatRobot.RobotMap;
 
 import edu.wpi.first.wpilibj.CANJaguar;
+import edu.wpi.first.wpilibj.DigitalInput;
 import edu.wpi.first.wpilibj.command.Subsystem;
 
 public class Arm extends Subsystem {
   private CANJaguar left, right;
+  ArrayList<DigitalInput> limitSwitches;
+  //channel index numbers correspond to limit switches
+  int[] channels;
+  private final int NUM_OF_SWITCHES = 4;
 
   public Arm() {
     left = new CANJaguar(RobotMap.ARM_LEFT);
     right = new CANJaguar(RobotMap.ARM_RIGHT);
+    
+    //channels are not known, these are random numbers 
+    channels = new int[]{0, 1, 2, 3};
+   
+    limitSwitches = new ArrayList<DigitalInput>();
+    //loop
+    for(int i = 0; i < NUM_OF_SWITCHES; i ++){
+       DigitalInput d = limitSwitches.get(i);
+       d = new DigitalInput(channels[i]);
+       
+       
+    }
+    
+    channels = new int[NUM_OF_SWITCHES];
+    
+    
   }
 
   public void initDefaultCommand() {
@@ -44,4 +67,9 @@ public class Arm extends Subsystem {
     left.set(0);
     right.set(0);
   }
+  
+  public int getLevel(){
+         //return last past switch 
+         return 0;
+  }
 }