edu.wpi.first.wpilibj

## Class SafePWM

- java.lang.Object
- - edu.wpi.first.wpilibj.SensorBase
  - - edu.wpi.first.wpilibj.PWM
    - - edu.wpi.first.wpilibj.SafePWM

- All Implemented Interfaces:
    LiveWindowSendable, MotorSafety, Sendable
  Direct Known Subclasses:
    PWMSpeedController

      public class SafePWM
      extends PWM
      implements MotorSafety

  Manages a PWM object.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.PWM

      `PWM.PeriodMultiplier`

  - ### Field Summary

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

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

    - ### Fields inherited from interface edu.wpi.first.wpilibj.MotorSafety

      `DEFAULT_SAFETY_EXPIRATION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SafePWM(int channel)` Constructor for a SafePWM object taking a channel number.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `disable()`
    `void` | `feed()` Feed the MotorSafety timer.
    `void` | `Feed()` Deprecated. Use `feed()` instead.
    `java.lang.String` | `getDescription()`
    `double` | `getExpiration()` Return the expiration time for the PWM object.
    `boolean` | `isAlive()` Check if the PWM object is currently alive or stopped due to a timeout.
    `boolean` | `isSafetyEnabled()` Check if motor safety is enabled for this object.
    `void` | `setExpiration(double timeout)` Set the expiration time for the PWM object.
    `void` | `setSafetyEnabled(boolean enabled)`
    `void` | `stopMotor()` Stop the motor associated with this PWM object.

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

      `enableDeadbandElimination, free, getChannel, getPosition, getRaw, getRawBounds, getSmartDashboardType, getSpeed, initTable, setBounds, setDisabled, setPeriodMultiplier, setPosition, setRaw, setSpeed, setZeroLatch, startLiveWindowMode, stopLiveWindowMode, updateTable`

    - ### 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

    - #### SafePWM

          public SafePWM(int channel)

      Constructor for a SafePWM object taking a channel number.
      Parameters:
        `channel` - The channel number to be used for the underlying PWM object. 0-9 are on-board, 10-19 are on the MXP port.

  - ### Method Detail

    - #### setExpiration

          public void setExpiration(double timeout)

      Set the expiration time for the PWM object.
      Specified by:
        `setExpiration` in interface `MotorSafety`
      Parameters:
        `timeout` - The timeout (in seconds) for this motor object

    - #### getExpiration

          public double getExpiration()

      Return the expiration time for the PWM object.
      Specified by:
        `getExpiration` in interface `MotorSafety`
      Returns:
        The expiration time value.

    - #### isAlive

          public boolean isAlive()

      Check if the PWM object is currently alive or stopped due to a timeout.
      Specified by:
        `isAlive` in interface `MotorSafety`
      Returns:
        a bool value that is true if the motor has NOT timed out and should still be running.

    - #### stopMotor

          public void stopMotor()

      Stop the motor associated with this PWM object. This is called by the MotorSafetyHelper object when it has a timeout for this PWM and needs to stop it from running.
      Specified by:
        `stopMotor` in interface `MotorSafety`

    - #### isSafetyEnabled

          public boolean isSafetyEnabled()

      Check if motor safety is enabled for this object.
      Specified by:
        `isSafetyEnabled` in interface `MotorSafety`
      Returns:
        True if motor safety is enforced for this object

    - #### Feed

          @Deprecated
          public void Feed()

      Deprecated. Use `feed()` instead.
      Feed the MotorSafety timer. This method is called by the subclass motor whenever it updates its speed, thereby resetting the timeout value.

    - #### feed

          public void feed()

      Feed the MotorSafety timer. This method is called by the subclass motor whenever it updates its speed, thereby resetting the timeout value.

    - #### setSafetyEnabled

          public void setSafetyEnabled(boolean enabled)

      Specified by:
        `setSafetyEnabled` in interface `MotorSafety`

    - #### getDescription

          public java.lang.String getDescription()

      Specified by:
        `getDescription` in interface `MotorSafety`

    - #### disable

          public void disable()