public class BrickletJoystick extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletJoystick.AnalogValue |
class |
BrickletJoystick.AnalogValueCallbackThreshold |
static interface |
BrickletJoystick.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletJoystick.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int, int, int) is reached. |
class |
BrickletJoystick.Position |
class |
BrickletJoystick.PositionCallbackThreshold |
static interface |
BrickletJoystick.PositionListener
This listener is triggered periodically with the period that is set by
setPositionCallbackPeriod(long) . |
static interface |
BrickletJoystick.PositionReachedListener
This listener is triggered when the threshold as set by
setPositionCallbackThreshold(char, short, short, short, short) is reached. |
static interface |
BrickletJoystick.PressedListener
This listener is triggered when the button is pressed.
|
static interface |
BrickletJoystick.ReleasedListener
This listener is triggered when the button is released.
|
Device.Identity
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_CALIBRATE |
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_IS_PRESSED |
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 |
---|
BrickletJoystick(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_POSITION
public static final byte FUNCTION_IS_PRESSED
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_CALIBRATE
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 BrickletJoystick(java.lang.String uid, IPConnection ipcon)
public BrickletJoystick.Position getPosition() throws TinkerforgeException
calibrate()
).
If you want to get the position periodically, it is recommended to use the
BrickletJoystick.PositionListener
listener and set the period with
setPositionCallbackPeriod(long)
.TinkerforgeException
public boolean isPressed() throws TinkerforgeException
BrickletJoystick.PressedListener
and BrickletJoystick.ReleasedListener
listeners
to handle the button.TinkerforgeException
public BrickletJoystick.AnalogValue getAnalogValue() throws TinkerforgeException
getPosition()
are 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 values periodically, it is recommended to use the
BrickletJoystick.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void calibrate() throws TinkerforgeException
TinkerforgeException
public void setPositionCallbackPeriod(long period) throws TinkerforgeException
BrickletJoystick.PositionListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletJoystick.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
BrickletJoystick.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletJoystick.AnalogValueListener
listener is only triggered if the analog values have
changed since the last triggering.TinkerforgeException
public long getAnalogValueCallbackPeriod() throws TinkerforgeException
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setPositionCallbackThreshold(char option, short minX, short maxX, short minY, short maxY) throws TinkerforgeException
BrickletJoystick.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 values (max is ignored)"
"'>'", "Listener is triggered when the position is greater than the min values (max is ignored)"
\endverbatimTinkerforgeException
public BrickletJoystick.PositionCallbackThreshold getPositionCallbackThreshold() throws TinkerforgeException
setPositionCallbackThreshold(char, short, short, short, short)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int minX, int maxX, int minY, int maxY) throws TinkerforgeException
BrickletJoystick.AnalogValueReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the analog values are *outside* the min and max values"
"'i'", "Listener is triggered when the analog values are *inside* the min and max values"
"'<'", "Listener is triggered when the analog values are smaller than the min values (max is ignored)"
"'>'", "Listener is triggered when the analog values are greater than the min values (max is ignored)"
\endverbatimTinkerforgeException
public BrickletJoystick.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletJoystick.PositionReachedListener
,
* BrickletJoystick.AnalogValueReachedListener
are triggered, if the thresholds
* setPositionCallbackThreshold(char, short, short, short, short)
,
* setAnalogValueCallbackThreshold(char, int, int, 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(BrickletJoystick.PositionListener listener)
public void removePositionListener(BrickletJoystick.PositionListener listener)
public void addAnalogValueListener(BrickletJoystick.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletJoystick.AnalogValueListener listener)
public void addPositionReachedListener(BrickletJoystick.PositionReachedListener listener)
public void removePositionReachedListener(BrickletJoystick.PositionReachedListener listener)
public void addAnalogValueReachedListener(BrickletJoystick.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletJoystick.AnalogValueReachedListener listener)
public void addPressedListener(BrickletJoystick.PressedListener listener)
public void removePressedListener(BrickletJoystick.PressedListener listener)
public void addReleasedListener(BrickletJoystick.ReleasedListener listener)
public void removeReleasedListener(BrickletJoystick.ReleasedListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.