From 574b06f3cc87b84c94b6d08465f3b6849209e58f Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 16 Nov 2015 21:01:11 -0800 Subject: [PATCH] add limit switch objects to arm subsystem --- .../frc3501/RiceCatRobot/subsystems/Arm.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java index 8d78c8f..3a69eea 100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java @@ -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 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(); + //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; + } } -- 2.30.2