public class BrickletVoltage extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletVoltage.AnalogValueCallbackThreshold |
static interface |
BrickletVoltage.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletVoltage.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int) is reached. |
class |
BrickletVoltage.VoltageCallbackThreshold |
static interface |
BrickletVoltage.VoltageListener
This listener is triggered periodically with the period that is set by
setVoltageCallbackPeriod(long) . |
static interface |
BrickletVoltage.VoltageReachedListener
This listener is triggered when the threshold as set by
setVoltageCallbackThreshold(char, int, int) is reached. |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_GET_ANALOG_VALUE |
static byte |
FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_GET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_VOLTAGE |
static byte |
FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD |
static char |
THRESHOLD_OPTION_GREATER |
static char |
THRESHOLD_OPTION_INSIDE |
static char |
THRESHOLD_OPTION_OFF |
static char |
THRESHOLD_OPTION_OUTSIDE |
static char |
THRESHOLD_OPTION_SMALLER |
Constructor and Description |
---|
BrickletVoltage(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_VOLTAGE
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_IDENTITY
public static final char THRESHOLD_OPTION_OFF
public static final char THRESHOLD_OPTION_OUTSIDE
public static final char THRESHOLD_OPTION_INSIDE
public static final char THRESHOLD_OPTION_SMALLER
public static final char THRESHOLD_OPTION_GREATER
public BrickletVoltage(java.lang.String uid, IPConnection ipcon)
public int getVoltage() throws TinkerforgeException
BrickletVoltage.VoltageListener
listener and set the period with
setVoltageCallbackPeriod(long)
.TinkerforgeException
public int getAnalogValue() throws TinkerforgeException
getVoltage()
is averaged over several samples
to yield less noise, while getAnalogValue()
gives back raw
unfiltered analog values. The only reason to use getAnalogValue()
is,
if you need the full resolution of the analog-to-digital converter.
If you want the analog value periodically, it is recommended to use the
BrickletVoltage.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setVoltageCallbackPeriod(long period) throws TinkerforgeException
BrickletVoltage.VoltageListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletVoltage.VoltageListener
listener is only triggered if the voltage has changed since
the last triggering.TinkerforgeException
public long getVoltageCallbackPeriod() throws TinkerforgeException
setVoltageCallbackPeriod(long)
.TinkerforgeException
public void setAnalogValueCallbackPeriod(long period) throws TinkerforgeException
BrickletVoltage.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletVoltage.AnalogValueListener
listener is only triggered if the analog value has
changed since the last triggering.TinkerforgeException
public long getAnalogValueCallbackPeriod() throws TinkerforgeException
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setVoltageCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletVoltage.VoltageReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the voltage is *outside* the min and max values"
"'i'", "Listener is triggered when the voltage is *inside* the min and max values"
"'<'", "Listener is triggered when the voltage is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the voltage is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletVoltage.VoltageCallbackThreshold getVoltageCallbackThreshold() throws TinkerforgeException
setVoltageCallbackThreshold(char, int, int)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletVoltage.AnalogValueReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the analog value is *outside* the min and max values"
"'i'", "Listener is triggered when the analog value is *inside* the min and max values"
"'<'", "Listener is triggered when the analog value is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the analog value is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletVoltage.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletVoltage.VoltageReachedListener
,
* BrickletVoltage.AnalogValueReachedListener
are triggered, if the thresholds
* setVoltageCallbackThreshold(char, int, int)
,
* setAnalogValueCallbackThreshold(char, int, int)
keep being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addVoltageListener(BrickletVoltage.VoltageListener listener)
public void removeVoltageListener(BrickletVoltage.VoltageListener listener)
public void addAnalogValueListener(BrickletVoltage.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletVoltage.AnalogValueListener listener)
public void addVoltageReachedListener(BrickletVoltage.VoltageReachedListener listener)
public void removeVoltageReachedListener(BrickletVoltage.VoltageReachedListener listener)
public void addAnalogValueReachedListener(BrickletVoltage.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletVoltage.AnalogValueReachedListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.