Package com.diozero.devices
Class PiconZero.PiconZeroPwmOutputDevice
java.lang.Object
com.diozero.internal.provider.AbstractDevice
com.diozero.devices.PiconZero.PiconZeroPwmOutputDevice
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,PwmOutputDeviceInterface
,java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- PiconZero
public static class PiconZero.PiconZeroPwmOutputDevice extends AbstractDevice implements PwmOutputDeviceInterface
-
Constructor Summary
Constructors Constructor Description PiconZeroPwmOutputDevice(PiconZero piconZero, java.lang.String key, int gpio, int channel, float initialValue)
-
Method Summary
Modifier and Type Method Description protected void
closeDevice()
int
getChannel()
int
getGpio()
int
getPwmNum()
Get the device PWM output device numberfloat
getValue()
Get the current PWM output value (0..1)void
setValue(float value)
Set the PWM output value (0..1)Methods inherited from class com.diozero.internal.provider.AbstractDevice
close, getDeviceFactory, getKey, isOpen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.provider.DeviceInterface
close, getKey, isOpen
-
Constructor Details
-
PiconZeroPwmOutputDevice
public PiconZeroPwmOutputDevice(PiconZero piconZero, java.lang.String key, int gpio, int channel, float initialValue)
-
-
Method Details
-
getGpio
public int getGpio()- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getChannel
public int getChannel() -
getPwmNum
public int getPwmNum()Description copied from interface:PwmOutputDeviceInterface
Get the device PWM output device number- Specified by:
getPwmNum
in interfacePwmOutputDeviceInterface
- Returns:
- Device native PWM output
-
getValue
Description copied from interface:PwmOutputDeviceInterface
Get the current PWM output value (0..1)- Specified by:
getValue
in interfacePwmOutputDeviceInterface
- Returns:
- Range is 0..1
- Throws:
RuntimeIOException
- if an I/O error occurs
-
setValue
Description copied from interface:PwmOutputDeviceInterface
Set the PWM output value (0..1)- Specified by:
setValue
in interfacePwmOutputDeviceInterface
- Parameters:
value
- Relative value in the range 0..1- Throws:
RuntimeIOException
- if an I/O error occurs
-
closeDevice
- Specified by:
closeDevice
in classAbstractDevice
- Throws:
RuntimeIOException
-