Class Solenoid

All Implemented Interfaces:
Sendable, AutoCloseable

public class Solenoid
extends SolenoidBase
implements Sendable, AutoCloseable
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.

  • Constructor Details

    • Solenoid

      public Solenoid​(int channel)
      Constructor using the default PCM ID (defaults to 0).
      channel - The channel on the PCM to control (0..7).
    • Solenoid

      public Solenoid​(int moduleNumber, int channel)
      moduleNumber - The CAN ID of the PCM the solenoid is attached to.
      channel - The channel on the PCM to control (0..7).
  • Method Details

    • close

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

      public void set​(boolean on)
      Set the value of a solenoid.
      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.
      True if the solenoid output is on or false if the solenoid output is off.
    • toggle

      public void toggle()
      Toggle the value of the solenoid.

      If the solenoid is set to on, it'll be turned off. If the solenoid is set to off, it'll be turned on.

    • getChannel

      public int getChannel()
      Get the channel this solenoid is connected to.
    • 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.
      If solenoid is disabled due to short.
      See Also:
    • setPulseDuration

      public void setPulseDuration​(double durationSeconds)
      Set the pulse duration in the PCM. This is used in conjunction with the startPulse method to allow the PCM to control the timing of a pulse. The timing can be controlled in 0.01 second increments.
      durationSeconds - The duration of the pulse, from 0.01 to 2.55 seconds.
      See Also:
    • startPulse

      public void startPulse()
      Trigger the PCM to generate a pulse of the duration set in setPulseDuration.
      See Also:
    • initSendable

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