Class PwmOutputDevice

java.lang.Object
com.diozero.api.GpioDevice
com.diozero.api.PwmOutputDevice
All Implemented Interfaces:
OutputDeviceInterface, Closeable, AutoCloseable
Direct Known Subclasses:
PwmLed

public class PwmOutputDevice
extends GpioDevice
implements OutputDeviceInterface
Provide generic Pulse Width Modulation (PWM) output control.
  • Field Details

  • Constructor Details

    • PwmOutputDevice

      public PwmOutputDevice​(int gpio) throws RuntimeIOException
      Parameters:
      gpio - GPIO to which the output device is connected.
      Throws:
      RuntimeIOException - If an I/O error occurred.
    • PwmOutputDevice

      public PwmOutputDevice​(int gpio, float initialValue) throws RuntimeIOException
      Parameters:
      gpio - GPIO to which the output device is connected.
      initialValue - Initial output value (0..1).
      Throws:
      RuntimeIOException - If an I/O error occurred.
    • PwmOutputDevice

      public PwmOutputDevice​(int gpio, int pwmFrequency, float initialValue) throws RuntimeIOException
      Parameters:
      gpio - GPIO to which the output device is connected.
      initialValue - Initial output value (0..1).
      pwmFrequency - PWM frequency (Hz).
      Throws:
      RuntimeIOException - If an I/O error occurred.
    • PwmOutputDevice

      public PwmOutputDevice​(PwmOutputDeviceFactoryInterface pwmDeviceFactory, int gpio, float initialValue) throws RuntimeIOException
      Parameters:
      pwmDeviceFactory - Device factory to use to provision this device.
      gpio - GPIO to which the output device is connected.
      initialValue - Initial output value (0..1).
      Throws:
      RuntimeIOException - If an I/O error occurred.
    • PwmOutputDevice

      public PwmOutputDevice​(PwmOutputDeviceFactoryInterface pwmDeviceFactory, int gpio, int pwmFrequency, float initialValue) throws RuntimeIOException
      Parameters:
      pwmDeviceFactory - Device factory to use to provision this device.
      gpio - GPIO to which the output device is connected.
      pwmFrequency - PWM frequency (Hz).
      initialValue - Initial output value (0..1).
      Throws:
      RuntimeIOException - If an I/O error occurred.
  • Method Details