public class BrickletAccelerometer extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletAccelerometer.Acceleration |
class |
BrickletAccelerometer.AccelerationCallbackThreshold |
static interface |
BrickletAccelerometer.AccelerationListener
This listener is triggered periodically with the period that is set by
setAccelerationCallbackPeriod(long) . |
static interface |
BrickletAccelerometer.AccelerationReachedListener
This listener is triggered when the threshold as set by
setAccelerationCallbackThreshold(char, short, short, short, short, short, short) is reached. |
class |
BrickletAccelerometer.Configuration |
Device.Identity
Constructor and Description |
---|
BrickletAccelerometer(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addAccelerationListener(BrickletAccelerometer.AccelerationListener listener)
Adds a Acceleration listener.
|
void |
addAccelerationReachedListener(BrickletAccelerometer.AccelerationReachedListener listener)
Adds a AccelerationReached listener.
|
BrickletAccelerometer.Acceleration |
getAcceleration()
Returns the acceleration in x, y and z direction.
|
long |
getAccelerationCallbackPeriod()
Returns the period as set by
setAccelerationCallbackPeriod(long) . |
BrickletAccelerometer.AccelerationCallbackThreshold |
getAccelerationCallbackThreshold()
Returns the threshold as set by
setAccelerationCallbackThreshold(char, short, short, short, short, short, short) . |
BrickletAccelerometer.Configuration |
getConfiguration()
Returns the configuration as set by
setConfiguration(short, short, short) . |
long |
getDebouncePeriod()
Returns the debounce period as set by
setDebouncePeriod(long) . |
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
short |
getTemperature()
Returns the temperature of the accelerometer.
|
boolean |
isLEDOn()
Returns *true* if the LED is enabled, *false* otherwise.
|
void |
ledOff()
Disables the LED on the Bricklet.
|
void |
ledOn()
Enables the LED on the Bricklet.
|
void |
removeAccelerationListener(BrickletAccelerometer.AccelerationListener listener)
Removes a Acceleration listener.
|
void |
removeAccelerationReachedListener(BrickletAccelerometer.AccelerationReachedListener listener)
Removes a AccelerationReached listener.
|
void |
setAccelerationCallbackPeriod(long period)
Sets the period with which the
BrickletAccelerometer.AccelerationListener listener is triggered
periodically. |
void |
setAccelerationCallbackThreshold(char option,
short minX,
short maxX,
short minY,
short maxY,
short minZ,
short maxZ)
Sets the thresholds for the
BrickletAccelerometer.AccelerationReachedListener listener. |
void |
setConfiguration(short dataRate,
short fullScale,
short filterBandwidth)
Configures the data rate, full scale range and filter bandwidth.
|
void |
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener
*
BrickletAccelerometer.AccelerationReachedListener
is triggered, if the threshold
* setAccelerationCallbackThreshold(char, short, short, short, short, short, short)
keeps being reached. |
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_ACCELERATION
public static final byte FUNCTION_SET_ACCELERATION_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ACCELERATION_CALLBACK_PERIOD
public static final byte FUNCTION_SET_ACCELERATION_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_ACCELERATION_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_TEMPERATURE
public static final byte FUNCTION_SET_CONFIGURATION
public static final byte FUNCTION_GET_CONFIGURATION
public static final byte FUNCTION_LED_ON
public static final byte FUNCTION_LED_OFF
public static final byte FUNCTION_IS_LED_ON
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 static final short DATA_RATE_OFF
public static final short DATA_RATE_3HZ
public static final short DATA_RATE_6HZ
public static final short DATA_RATE_12HZ
public static final short DATA_RATE_25HZ
public static final short DATA_RATE_50HZ
public static final short DATA_RATE_100HZ
public static final short DATA_RATE_400HZ
public static final short DATA_RATE_800HZ
public static final short DATA_RATE_1600HZ
public static final short FULL_SCALE_2G
public static final short FULL_SCALE_4G
public static final short FULL_SCALE_6G
public static final short FULL_SCALE_8G
public static final short FULL_SCALE_16G
public static final short FILTER_BANDWIDTH_800HZ
public static final short FILTER_BANDWIDTH_400HZ
public static final short FILTER_BANDWIDTH_200HZ
public static final short FILTER_BANDWIDTH_50HZ
public BrickletAccelerometer(java.lang.String uid, IPConnection ipcon)
public BrickletAccelerometer.Acceleration getAcceleration() throws TinkerforgeException
setConfiguration(short, short, short)
.
If you want to get the acceleration periodically, it is recommended
to use the BrickletAccelerometer.AccelerationListener
listener and set the period with
setAccelerationCallbackPeriod(long)
.TinkerforgeException
public void setAccelerationCallbackPeriod(long period) throws TinkerforgeException
BrickletAccelerometer.AccelerationListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletAccelerometer.AccelerationListener
listener is only triggered if the acceleration has
changed since the last triggering.TinkerforgeException
public long getAccelerationCallbackPeriod() throws TinkerforgeException
setAccelerationCallbackPeriod(long)
.TinkerforgeException
public void setAccelerationCallbackThreshold(char option, short minX, short maxX, short minY, short maxY, short minZ, short maxZ) throws TinkerforgeException
BrickletAccelerometer.AccelerationReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the acceleration is *outside* the min and max values"
"'i'", "Listener is triggered when the acceleration is *inside* the min and max values"
"'<'", "Listener is triggered when the acceleration is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the acceleration is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletAccelerometer.AccelerationCallbackThreshold getAccelerationCallbackThreshold() throws TinkerforgeException
setAccelerationCallbackThreshold(char, short, short, short, short, short, short)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletAccelerometer.AccelerationReachedListener
is triggered, if the threshold
* setAccelerationCallbackThreshold(char, short, short, short, short, short, short)
keeps being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public short getTemperature() throws TinkerforgeException
TinkerforgeException
public void setConfiguration(short dataRate, short fullScale, short filterBandwidth) throws TinkerforgeException
TinkerforgeException
public BrickletAccelerometer.Configuration getConfiguration() throws TinkerforgeException
setConfiguration(short, short, short)
.TinkerforgeException
public void ledOn() throws TinkerforgeException
TinkerforgeException
public void ledOff() throws TinkerforgeException
TinkerforgeException
public boolean isLEDOn() throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addAccelerationListener(BrickletAccelerometer.AccelerationListener listener)
public void removeAccelerationListener(BrickletAccelerometer.AccelerationListener listener)
public void addAccelerationReachedListener(BrickletAccelerometer.AccelerationReachedListener listener)
public void removeAccelerationReachedListener(BrickletAccelerometer.AccelerationReachedListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.