Class Solenoid

  • All Implemented Interfaces:
    Sendable, AutoCloseable

    public class Solenoid
    extends SolenoidBase
    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 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

      • 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()
      • 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.
        Parameters:
        durationSeconds - The duration of the pulse, from 0.01 to 2.55 seconds.
        See Also:
        startPulse()
      • startPulse

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

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