Package com.diozero.devices
Class PiconZero.PiconZeroAnalogInputDevice
java.lang.Object
com.diozero.internal.spi.AbstractDevice
com.diozero.internal.spi.AbstractInputDevice<AnalogInputEvent>
com.diozero.devices.PiconZero.PiconZeroAnalogInputDevice
- All Implemented Interfaces:
DeviceInterface
,AnalogInputDeviceInterface
,Closeable
,AutoCloseable
- Enclosing class:
- PiconZero
public static class PiconZero.PiconZeroAnalogInputDevice extends AbstractInputDevice<AnalogInputEvent> implements AnalogInputDeviceInterface
-
Constructor Summary
Constructors Constructor Description PiconZeroAnalogInputDevice(PiconZero piconZero, String key, PinInfo pinInfo)
-
Method Summary
Modifier and Type Method Description protected void
closeDevice()
int
getAdcNumber()
int
getChannel()
float
getValue()
Read the analog value in the range 0..1 or -1..1 (if the ADC type is signed)Methods inherited from class com.diozero.internal.spi.AbstractInputDevice
accept, disableListener, enableListener, generatesEvents, removeListener, setListener
Methods inherited from class com.diozero.internal.spi.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.spi.AnalogInputDeviceInterface
close, generatesEvents, getMode, removeListener, setListener
Methods inherited from interface com.diozero.api.DeviceInterface
getKey, isOpen
-
Constructor Details
-
PiconZeroAnalogInputDevice
-
-
Method Details
-
closeDevice
protected void closeDevice()- Specified by:
closeDevice
in classAbstractDevice
-
getValue
Description copied from interface:AnalogInputDeviceInterface
Read the analog value in the range 0..1 or -1..1 (if the ADC type is signed)- Specified by:
getValue
in interfaceAnalogInputDeviceInterface
- Returns:
- the unscaled value (-1..1)
- Throws:
RuntimeIOException
- if an I/O error occurs
-
getAdcNumber
public int getAdcNumber()- Specified by:
getAdcNumber
in interfaceAnalogInputDeviceInterface
-
getChannel
public int getChannel()
-