Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Robot2019/src/main/java/frc/robot/subsystems/HatchPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;


public class HatchPanel extends Subsystem {
private DoubleSolenoid pistons;
private String pistonState;

/**
* Subsystem for controlling the hatch panel mechanism
Expand All @@ -21,6 +23,9 @@ public class HatchPanel extends Subsystem {
*/
public HatchPanel(DoubleSolenoid pistons) {
this.pistons = pistons;
pistonState = "IN";
pistons.set(DoubleSolenoid.Value.kReverse);
SmartDashboard.putString("Hatch Piston State", pistonState);
}

/**
Expand All @@ -31,9 +36,13 @@ public HatchPanel(DoubleSolenoid pistons) {
public boolean toggle() {
if (pistons.get() == DoubleSolenoid.Value.kForward) {
pistons.set(DoubleSolenoid.Value.kReverse);
pistonState = "IN";
SmartDashboard.putString("Hatch Piston State", pistonState);
return false;
} else {
pistons.set(DoubleSolenoid.Value.kForward);
pistonState = "OUT";
SmartDashboard.putString("Hatch Piston State", pistonState);
return true;
}
}
Expand Down