summaryrefslogtreecommitdiff
path: root/src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java')
-rw-r--r--src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java b/src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java
new file mode 100644
index 0000000..8698277
--- /dev/null
+++ b/src/org/usfirst/frc/team4272/robotlib/DoubleSolenoid.java
@@ -0,0 +1,39 @@
+package org.usfirst.frc.team4272.robotlib;
+
+public class DoubleSolenoid extends edu.wpi.first.wpilibj.DoubleSolenoid {
+ private boolean enabled = true;
+ private Value value;
+
+ public DoubleSolenoid(int forwardChannel, int reverseChannel) {
+ super(forwardChannel, reverseChannel);
+ value = get();
+ }
+ public DoubleSolenoid(int moduleNumber, int forwardChannel, int reverseChannel) {
+ super(moduleNumber, forwardChannel, reverseChannel);
+ value = get();
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ if (enabled) {
+ set(value);
+ } else {
+ set(Value.kOff);
+ }
+ }
+
+ public void setForward(boolean forward) {
+ set(forward ? Value.kForward : Value.kReverse);
+ }
+
+ public boolean getForward() {
+ return value == Value.kForward;
+ }
+
+ public void set(Value value) {
+ this.value = value;
+ if (enabled) {
+ super.set(value);
+ }
+ }
+}