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 class
DoubleSolenoid.Value
Possible 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 void
close()
DoubleSolenoid.Value
get()
Read the current value of the solenoid.int
getFwdChannel()
Get the forward channel.int
getRevChannel()
Get the reverse channel.void
initSendable(SendableBuilder builder)
Initializes thisSendable
object.boolean
isFwdSolenoidDisabled()
Check if the forward solenoid is Disabled.boolean
isRevSolenoidDisabled()
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
-