Package edu.wpi.first.wpilibj
Class DoubleSolenoid
java.lang.Object
edu.wpi.first.wpilibj.DoubleSolenoid
- All Implemented Interfaces:
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
Modifier and TypeClassDescriptionstatic enum
Possible values for a DoubleSolenoid. -
Constructor Summary
ConstructorDescriptionDoubleSolenoid
(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 TypeMethodDescriptionvoid
close()
get()
Read the current value of the solenoid.int
Get the forward channel.int
Get the reverse channel.void
initSendable
(SendableBuilder builder) Initializes thisSendable
object.boolean
Check if the forward solenoid is Disabled.boolean
Check if the reverse solenoid is Disabled.void
set
(DoubleSolenoid.Value value) Set the value of a solenoid.void
toggle()
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:
close
in 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:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- sendable builder
-