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.

  • Constructor Details

    • DoubleSolenoid

      public DoubleSolenoid​(PneumaticsModuleType moduleType, int forwardChannel, int reverseChannel)
      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

      public void close()
      Specified by:
      close in interface AutoCloseable
    • set

      public void set​(DoubleSolenoid.Value value)
      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

      public void 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

      public int getFwdChannel()
      Get the forward channel.
      Returns:
      the forward channel.
    • getRevChannel

      public int getRevChannel()
      Get the reverse channel.
      Returns:
      the reverse channel.
    • isFwdSolenoidDisabled

      public boolean 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

      public boolean 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

      public void initSendable​(SendableBuilder builder)
      Description copied from interface: Sendable
      Initializes this Sendable object.
      Specified by:
      initSendable in interface Sendable
      Parameters:
      builder - sendable builder