edu.wpi.first.wpilibj

## Class Solenoid

- java.lang.Object
- - edu.wpi.first.wpilibj.SensorBase
  - - edu.wpi.first.wpilibj.SolenoidBase
    - - edu.wpi.first.wpilibj.Solenoid

- All Implemented Interfaces:
    LiveWindowSendable, Sendable

      public class Solenoid
      extends SolenoidBase
      implements LiveWindowSendable

  Solenoid class for running high voltage Digital Output on the PCM.

  The Solenoid class is typically used for pneumatic solenoids, but could be used for any device within the current spec of the PCM.

- - ### Field Summary

    - ### Fields inherited from class edu.wpi.first.wpilibj.SolenoidBase

      `m_moduleNumber`

    - ### Fields inherited from class edu.wpi.first.wpilibj.SensorBase

      `kAnalogInputChannels, kAnalogOutputChannels, kDigitalChannels, kPCMModules, kPDPChannels, kPDPModules, kPwmChannels, kRelayChannels, kSolenoidChannels, kSystemClockTicksPerMicrosecond`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Solenoid(int channel)` Constructor using the default PCM ID (defaults to 0).
    `Solenoid(int moduleNumber, int channel)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `free()` Destructor.
    `boolean` | `get()` Read the current value of the solenoid.
    `java.lang.String` | `getSmartDashboardType()` The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.
    `void` | `initTable(NetworkTable subtable)` Initializes a table for this `Sendable` object.
    `boolean` | `isBlackListed()` Check if solenoid is blacklisted.
    `void` | `set(boolean on)` Set the value of a solenoid.
    `void` | `startLiveWindowMode()` Start having this sendable object automatically respond to value changes reflect the value on the table.
    `void` | `stopLiveWindowMode()` Stop having this sendable object automatically respond to value changes.
    `void` | `updateTable()` Update the table for this sendable object with the latest values.

    - ### Methods inherited from class edu.wpi.first.wpilibj.SolenoidBase

      `clearAllPCMStickyFaults, clearAllPCMStickyFaults, getAll, getAll, getPCMSolenoidBlackList, getPCMSolenoidBlackList, getPCMSolenoidVoltageFault, getPCMSolenoidVoltageFault, getPCMSolenoidVoltageStickyFault, getPCMSolenoidVoltageStickyFault`

    - ### Methods inherited from class edu.wpi.first.wpilibj.SensorBase

      `checkAnalogInputChannel, checkAnalogOutputChannel, checkDigitalChannel, checkPDPChannel, checkPDPModule, checkPWMChannel, checkRelayChannel, checkSolenoidChannel, checkSolenoidModule, getDefaultSolenoidModule, setDefaultSolenoidModule`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Solenoid

          public Solenoid(int channel)

      Constructor using the default PCM ID (defaults to 0).
      Parameters:
        `channel` - The channel on the PCM to control (0..7).

    - #### Solenoid

          public Solenoid(int moduleNumber,
                          int channel)

      Constructor.
      Parameters:
        `moduleNumber` - The CAN ID of the PCM the solenoid is attached to.
        `channel` - The channel on the PCM to control (0..7).

  - ### Method Detail

    - #### free

          public void free()

      Destructor.
      Overrides:
        `free` in class `SensorBase`

    - #### set

          public void set(boolean on)

      Set the value of a solenoid.
      Parameters:
        `on` - True will turn the solenoid output on. False will turn the solenoid output off.

    - #### get

          public boolean get()

      Read the current value of the solenoid.
      Returns:
        True if the solenoid output is on or false if the solenoid output is off.

    - #### isBlackListed

          public boolean isBlackListed()

      Check if solenoid is blacklisted. If a solenoid is shorted, it is added to the blacklist and disabled until power cycle, or until faults are cleared.
      Returns:
        If solenoid is disabled due to short.
      See Also:
        `SolenoidBase.clearAllPCMStickyFaults()`

    - #### getSmartDashboardType

          public java.lang.String getSmartDashboardType()

      Description copied from interface: `Sendable`
      The string representation of the named data type that will be used by the smart dashboard for this `Sendable`.
      Specified by:
        `getSmartDashboardType` in interface `Sendable`
      Returns:
        The type of this `Sendable`.

    - #### initTable

          public void initTable(NetworkTable subtable)

      Description copied from interface: `Sendable`
      Initializes a table for this `Sendable` object.
      Specified by:
        `initTable` in interface `Sendable`
      Parameters:
        `subtable` - The table to put the values in.

    - #### updateTable

          public void updateTable()

      Description copied from interface: `LiveWindowSendable`
      Update the table for this sendable object with the latest values.
      Specified by:
        `updateTable` in interface `LiveWindowSendable`

    - #### startLiveWindowMode

          public void startLiveWindowMode()

      Description copied from interface: `LiveWindowSendable`
      Start having this sendable object automatically respond to value changes reflect the value on the table.
      Specified by:
        `startLiveWindowMode` in interface `LiveWindowSendable`

    - #### stopLiveWindowMode

          public void stopLiveWindowMode()

      Description copied from interface: `LiveWindowSendable`
      Stop having this sendable object automatically respond to value changes.
      Specified by:
        `stopLiveWindowMode` in interface `LiveWindowSendable`