-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42e392a
commit 7f629b5
Showing
4 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/org/usfirst/frc/team1002/robot/subsystems/LiftSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.usfirst.frc.team1002.robot.subsystems; | ||
|
||
import org.usfirst.frc.team1002.robot.RobotMap; | ||
import org.usfirst.frc.team1002.robot.commands.Lift; | ||
|
||
import edu.wpi.first.wpilibj.CANTalon; | ||
import edu.wpi.first.wpilibj.DigitalInput; | ||
import edu.wpi.first.wpilibj.command.Subsystem; | ||
|
||
public class LiftSystem extends Subsystem { | ||
public static CANTalon liftMotor; | ||
|
||
public static DigitalInput limitSensorTop; | ||
public static DigitalInput limitSensorBot; | ||
|
||
/** | ||
* Internal lift speed setter. Use the Lift command instead. | ||
* | ||
* @param speed Internal speed value. | ||
*/ | ||
public static void lift(double speed) { | ||
if (limitSensorBot.get() && speed < 0 || limitSensorTop.get() && speed > 0 && !Dashboard.getButton(0)) speed = 0; | ||
liftMotor.set(speed); | ||
} | ||
|
||
public LiftSystem() { | ||
liftMotor = new CANTalon(RobotMap.liftMotor); | ||
limitSensorTop = new DigitalInput(RobotMap.limitSwitches[0]); | ||
limitSensorBot = new DigitalInput(RobotMap.limitSwitches[1]); | ||
lift(0); | ||
} | ||
|
||
@Override | ||
public void initDefaultCommand() { | ||
setDefaultCommand(new Lift(0)); | ||
} | ||
} |