From 387332c81c11ecadfcbef606924e774fb0a7825a Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 16 Nov 2015 21:23:29 -0800 Subject: [PATCH] make naive method for updating currentLevel/ check values of limit switches --- .../frc3501/RiceCatRobot/subsystems/Arm.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java index 3a69eea..e584153 100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java @@ -10,9 +10,10 @@ import edu.wpi.first.wpilibj.command.Subsystem; public class Arm extends Subsystem { private CANJaguar left, right; - ArrayList limitSwitches; + private ArrayList 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; -- 2.30.2