Package com.diozero.api
Class AnalogInputEvent
java.lang.Object
com.diozero.api.Event
com.diozero.api.DeviceEvent
com.diozero.api.AnalogInputEvent
public class AnalogInputEvent extends DeviceEvent
Represents an input event from an analog device.
-
Constructor Summary
Constructors Constructor Description AnalogInputEvent(int gpio, long epochTime, long nanoTime, float unscaledValue)
Constructs an input event from an analog device. -
Method Summary
Modifier and Type Method Description float
getRange()
Get the maximum scaled value for the analog input device that generated this eventfloat
getScaledValue()
Value from -range..rangefloat
getUnscaledValue()
Value from -1..1String
toString()
Methods inherited from class com.diozero.api.DeviceEvent
getGpio
Methods inherited from class com.diozero.api.Event
getEpochTime, getNanoTime
-
Constructor Details
-
AnalogInputEvent
public AnalogInputEvent(int gpio, long epochTime, long nanoTime, float unscaledValue)Constructs an input event from an analog device. See (@link com.diozero.api.DeviceEvent} for first 3 parameters.- Parameters:
gpio
-epochTime
-nanoTime
-unscaledValue
- initial value (unscaled)
-
-
Method Details
-
getRange
public float getRange()Get the maximum scaled value for the analog input device that generated this event- Returns:
- the maximum scaled value
-
getUnscaledValue
public float getUnscaledValue()Value from -1..1- Returns:
- the unscaled value
-
getScaledValue
public float getScaledValue()Value from -range..range- Returns:
- the scaled value
-
toString
-