Solenoid

class wpilib.Solenoid(*args, **kwargs)[source]

Bases: wpilib.SolenoidBase

Solenoid class for running high voltage Digital Output.

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

Constructor.

Arguments can be supplied as positional or keyword. Acceptable positional argument combinations are:

  • channel
  • moduleNumber, channel

Alternatively, the above names can be used as keyword arguments.

Parameters:
  • moduleNumber (int) – The CAN ID of the PCM the solenoid is attached to
  • channel (int) – The channel on the PCM to control (0..7)
free()[source]

Mark the solenoid as freed.

get()[source]

Read the current value of the solenoid.

Returns:The current value of the solenoid.
Return type:bool
isBlackListed()[source]
Check if the solenoid is blacklisted.
If a solenoid is shorted, it is added to the blacklist and disabled until power cycle, or until faults are cleared. See clearAllPCMStickyFaults()
Returns:If solenoid is disabled due to short.
set(on)[source]

Set the value of a solenoid.

Parameters:on (bool) – Turn the solenoid output off or on.