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
All Methods Instance Methods Concrete Methods 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 Detail
-
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
- the gpio number that this event is related toepochTime
- time in milliseconds since Jan 1st 1970nanoTime
- monotonic time in nanosecondsunscaledValue
- initial value (unscaled)
-
-
Method Detail
-
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
-
-