Package edu.wpi.first.wpilibj
Class DoubleSolenoid
java.lang.Object
edu.wpi.first.wpilibj.DoubleSolenoid
- All Implemented Interfaces:
Sendable,AutoCloseable
public class DoubleSolenoid extends Object implements Sendable, AutoCloseable
DoubleSolenoid class for running 2 channels of high voltage Digital Output on the pneumatics
module.
The DoubleSolenoid class is typically used for pneumatics solenoids that have two positions controlled by two separate channels.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDoubleSolenoid.ValuePossible values for a DoubleSolenoid. -
Constructor Summary
Constructors Constructor Description DoubleSolenoid(int module, PneumaticsModuleType moduleType, int forwardChannel, int reverseChannel)Constructs a double solenoid for a specified module of a specific module type.DoubleSolenoid(PneumaticsModuleType moduleType, int forwardChannel, int reverseChannel)Constructs a double solenoid for a default module of a specific module type. -
Method Summary
Modifier and Type Method Description voidclose()DoubleSolenoid.Valueget()Read the current value of the solenoid.intgetFwdChannel()Get the forward channel.intgetRevChannel()Get the reverse channel.voidinitSendable(SendableBuilder builder)Initializes thisSendableobject.booleanisFwdSolenoidDisabled()Check if the forward solenoid is Disabled.booleanisRevSolenoidDisabled()Check if the reverse solenoid is Disabled.voidset(DoubleSolenoid.Value value)Set the value of a solenoid.voidtoggle()Toggle the value of the solenoid.
-
Constructor Details
-
DoubleSolenoid
Constructs a double solenoid for a default module of a specific module type.- Parameters:
moduleType- The module type to use.forwardChannel- The forward channel on the module to control.reverseChannel- The reverse channel on the module to control.
-
DoubleSolenoid
public DoubleSolenoid(int module, PneumaticsModuleType moduleType, int forwardChannel, int reverseChannel)Constructs a double solenoid for a specified module of a specific module type.- Parameters:
module- The module of the solenoid module to use.moduleType- The module type to use.forwardChannel- The forward channel on the module to control.reverseChannel- The reverse channel on the module to control.
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
set
Set the value of a solenoid.- Parameters:
value- The value to set (Off, Forward, Reverse)
-
get
Read the current value of the solenoid.- Returns:
- The current value of the solenoid.
-
toggle
Toggle the value of the solenoid.If the solenoid is set to forward, it'll be set to reverse. If the solenoid is set to reverse, it'll be set to forward. If the solenoid is set to off, nothing happens.
-
getFwdChannel
Get the forward channel.- Returns:
- the forward channel.
-
getRevChannel
Get the reverse channel.- Returns:
- the reverse channel.
-
isFwdSolenoidDisabled
Check if the forward solenoid is Disabled. If a solenoid is shorted, it is added to the DisabledList and disabled until power cycle, or until faults are cleared.- Returns:
- If solenoid is disabled due to short.
-
isRevSolenoidDisabled
Check if the reverse solenoid is Disabled. If a solenoid is shorted, it is added to the DisabledList and disabled until power cycle, or until faults are cleared.- Returns:
- If solenoid is disabled due to short.
-
initSendable
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-