public class BrickletLinearPoti extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletLinearPoti.AnalogValueCallbackThreshold |
static interface |
BrickletLinearPoti.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletLinearPoti.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int) is reached. |
class |
BrickletLinearPoti.PositionCallbackThreshold |
static interface |
BrickletLinearPoti.PositionListener
This listener is triggered periodically with the period that is set by
setPositionCallbackPeriod(long) . |
static interface |
BrickletLinearPoti.PositionReachedListener
This listener is triggered when the threshold as set by
setPositionCallbackThreshold(char, int, int) is reached. |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static 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_POSITION |
static byte |
FUNCTION_GET_POSITION_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_POSITION_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_POSITION_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_POSITION_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 |
---|
BrickletLinearPoti(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 String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_POSITION
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_SET_POSITION_CALLBACK_PERIOD
public static final byte FUNCTION_GET_POSITION_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_POSITION_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_POSITION_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 BrickletLinearPoti(String uid, IPConnection ipcon)
public int getPosition() throws TinkerforgeException
BrickletLinearPoti.PositionListener
listener and set the period with
setPositionCallbackPeriod(long)
.TinkerforgeException
public int getAnalogValue() throws TinkerforgeException
getPosition()
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
BrickletLinearPoti.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setPositionCallbackPeriod(long period) throws TinkerforgeException
BrickletLinearPoti.PositionListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletLinearPoti.PositionListener
listener is only triggered if the position has changed
since the last triggering.TinkerforgeException
public long getPositionCallbackPeriod() throws TinkerforgeException
setPositionCallbackPeriod(long)
.TinkerforgeException
public void setAnalogValueCallbackPeriod(long period) throws TinkerforgeException
BrickletLinearPoti.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletLinearPoti.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 setPositionCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletLinearPoti.PositionReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the position is *outside* the min and max values"
"'i'", "Listener is triggered when the position is *inside* the min and max values"
"'<'", "Listener is triggered when the position is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the position is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletLinearPoti.PositionCallbackThreshold getPositionCallbackThreshold() throws TinkerforgeException
setPositionCallbackThreshold(char, int, int)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletLinearPoti.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 BrickletLinearPoti.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletLinearPoti.PositionReachedListener
,
* BrickletLinearPoti.AnalogValueReachedListener
are triggered, if the thresholds
* setPositionCallbackThreshold(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 addPositionListener(BrickletLinearPoti.PositionListener listener)
public void removePositionListener(BrickletLinearPoti.PositionListener listener)
public void addAnalogValueListener(BrickletLinearPoti.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletLinearPoti.AnalogValueListener listener)
public void addPositionReachedListener(BrickletLinearPoti.PositionReachedListener listener)
public void removePositionReachedListener(BrickletLinearPoti.PositionReachedListener listener)
public void addAnalogValueReachedListener(BrickletLinearPoti.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletLinearPoti.AnalogValueReachedListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.