blob: 8698277995e1d25da88ac2f2c51a624e9022647d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
}
}
}
|