public class BrickletCurrent12 extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletCurrent12.AnalogValueCallbackThreshold |
static interface |
BrickletCurrent12.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletCurrent12.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int) is reached. |
class |
BrickletCurrent12.CurrentCallbackThreshold |
static interface |
BrickletCurrent12.CurrentListener
This listener is triggered periodically with the period that is set by
setCurrentCallbackPeriod(long) . |
static interface |
BrickletCurrent12.CurrentReachedListener
This listener is triggered when the threshold as set by
setCurrentCallbackThreshold(char, short, short) is reached. |
static interface |
BrickletCurrent12.OverCurrentListener
This listener is triggered when an over current is measured
(see
isOverCurrent() ). |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static 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_CURRENT |
static byte |
FUNCTION_GET_CURRENT_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD |
static byte |
FUNCTION_GET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_IS_OVER_CURRENT |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_CURRENT_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
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 |
---|
BrickletCurrent12(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_CURRENT
public static final byte FUNCTION_CALIBRATE
public static final byte FUNCTION_IS_OVER_CURRENT
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_SET_CURRENT_CALLBACK_PERIOD
public static final byte FUNCTION_GET_CURRENT_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_CURRENT_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_CURRENT_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 BrickletCurrent12(String uid, IPConnection ipcon)
public short getCurrent() throws TinkerforgeException
BrickletCurrent12.CurrentListener
listener and set the period with
setCurrentCallbackPeriod(long)
.TinkerforgeException
public void calibrate() throws TinkerforgeException
TinkerforgeException
public boolean isOverCurrent() throws TinkerforgeException
TinkerforgeException
public int getAnalogValue() throws TinkerforgeException
getCurrent()
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
BrickletCurrent12.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setCurrentCallbackPeriod(long period) throws TinkerforgeException
BrickletCurrent12.CurrentListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletCurrent12.CurrentListener
listener is only triggered if the current has changed since
the last triggering.TinkerforgeException
public long getCurrentCallbackPeriod() throws TinkerforgeException
setCurrentCallbackPeriod(long)
.TinkerforgeException
public void setAnalogValueCallbackPeriod(long period) throws TinkerforgeException
BrickletCurrent12.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletCurrent12.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 setCurrentCallbackThreshold(char option, short min, short max) throws TinkerforgeException
BrickletCurrent12.CurrentReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the current is *outside* the min and max values"
"'i'", "Listener is triggered when the current is *inside* the min and max values"
"'<'", "Listener is triggered when the current is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the current is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletCurrent12.CurrentCallbackThreshold getCurrentCallbackThreshold() throws TinkerforgeException
setCurrentCallbackThreshold(char, short, short)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletCurrent12.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 BrickletCurrent12.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletCurrent12.CurrentReachedListener
,
* BrickletCurrent12.AnalogValueReachedListener
are triggered, if the thresholds
* setCurrentCallbackThreshold(char, short, short)
,
* 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 addCurrentListener(BrickletCurrent12.CurrentListener listener)
public void removeCurrentListener(BrickletCurrent12.CurrentListener listener)
public void addAnalogValueListener(BrickletCurrent12.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletCurrent12.AnalogValueListener listener)
public void addCurrentReachedListener(BrickletCurrent12.CurrentReachedListener listener)
public void removeCurrentReachedListener(BrickletCurrent12.CurrentReachedListener listener)
public void addAnalogValueReachedListener(BrickletCurrent12.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletCurrent12.AnalogValueReachedListener listener)
public void addOverCurrentListener(BrickletCurrent12.OverCurrentListener listener)
public void removeOverCurrentListener(BrickletCurrent12.OverCurrentListener listener)
Copyright © 2022 Tinkerforge GmbH. All rights reserved.