public class BrickletIndustrialDualAnalogIn extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletIndustrialDualAnalogIn.Calibration |
class |
BrickletIndustrialDualAnalogIn.VoltageCallbackThreshold |
static interface |
BrickletIndustrialDualAnalogIn.VoltageListener
This listener is triggered periodically with the period that is set by
setVoltageCallbackPeriod(short, long) . |
static interface |
BrickletIndustrialDualAnalogIn.VoltageReachedListener
This listener is triggered when the threshold as set by
setVoltageCallbackThreshold(short, char, int, int) is reached. |
Device.Identity
Constructor and Description |
---|
BrickletIndustrialDualAnalogIn(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addVoltageListener(BrickletIndustrialDualAnalogIn.VoltageListener listener)
Adds a Voltage listener.
|
void |
addVoltageReachedListener(BrickletIndustrialDualAnalogIn.VoltageReachedListener listener)
Adds a VoltageReached listener.
|
int[] |
getADCValues()
Returns the ADC values as given by the MCP3911 IC.
|
BrickletIndustrialDualAnalogIn.Calibration |
getCalibration()
Returns the calibration as set by
setCalibration(int[], int[]) . |
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 |
getSampleRate()
Returns the sample rate as set by
setSampleRate(short) . |
int |
getVoltage(short channel)
Returns the voltage for the given channel.
|
long |
getVoltageCallbackPeriod(short channel)
Returns the period as set by
setVoltageCallbackPeriod(short, long) . |
BrickletIndustrialDualAnalogIn.VoltageCallbackThreshold |
getVoltageCallbackThreshold(short channel)
Returns the threshold as set by
setVoltageCallbackThreshold(short, char, int, int) . |
void |
removeVoltageListener(BrickletIndustrialDualAnalogIn.VoltageListener listener)
Removes a Voltage listener.
|
void |
removeVoltageReachedListener(BrickletIndustrialDualAnalogIn.VoltageReachedListener listener)
Removes a VoltageReached listener.
|
void |
setCalibration(int[] offset,
int[] gain)
Sets offset and gain of MCP3911 internal calibration registers.
|
void |
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener
*
BrickletIndustrialDualAnalogIn.VoltageReachedListener
is triggered, if the threshold
* setVoltageCallbackThreshold(short, char, int, int)
keeps being reached. |
void |
setSampleRate(short rate)
Sets the sample rate.
|
void |
setVoltageCallbackPeriod(short channel,
long period)
Sets the period with which the
BrickletIndustrialDualAnalogIn.VoltageListener listener is triggered
periodically for the given channel. |
void |
setVoltageCallbackThreshold(short channel,
char option,
int min,
int max)
Sets the thresholds for the
BrickletIndustrialDualAnalogIn.VoltageReachedListener listener for the given
channel. |
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_VOLTAGE
public static final byte FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_VOLTAGE_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_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_SAMPLE_RATE
public static final byte FUNCTION_GET_SAMPLE_RATE
public static final byte FUNCTION_SET_CALIBRATION
public static final byte FUNCTION_GET_CALIBRATION
public static final byte FUNCTION_GET_ADC_VALUES
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 SAMPLE_RATE_976_SPS
public static final short SAMPLE_RATE_488_SPS
public static final short SAMPLE_RATE_244_SPS
public static final short SAMPLE_RATE_122_SPS
public static final short SAMPLE_RATE_61_SPS
public static final short SAMPLE_RATE_4_SPS
public static final short SAMPLE_RATE_2_SPS
public static final short SAMPLE_RATE_1_SPS
public BrickletIndustrialDualAnalogIn(String uid, IPConnection ipcon)
public int getVoltage(short channel) throws TinkerforgeException
BrickletIndustrialDualAnalogIn.VoltageListener
listener and set the period with
setVoltageCallbackPeriod(short, long)
.TinkerforgeException
public void setVoltageCallbackPeriod(short channel, long period) throws TinkerforgeException
BrickletIndustrialDualAnalogIn.VoltageListener
listener is triggered
periodically for the given channel. A value of 0 turns the listener off.
The BrickletIndustrialDualAnalogIn.VoltageListener
listener is only triggered if the voltage has changed since the
last triggering.TinkerforgeException
public long getVoltageCallbackPeriod(short channel) throws TinkerforgeException
setVoltageCallbackPeriod(short, long)
.TinkerforgeException
public void setVoltageCallbackThreshold(short channel, char option, int min, int max) throws TinkerforgeException
BrickletIndustrialDualAnalogIn.VoltageReachedListener
listener for the given
channel.
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 BrickletIndustrialDualAnalogIn.VoltageCallbackThreshold getVoltageCallbackThreshold(short channel) throws TinkerforgeException
setVoltageCallbackThreshold(short, char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletIndustrialDualAnalogIn.VoltageReachedListener
is triggered, if the threshold
* setVoltageCallbackThreshold(short, char, int, int)
keeps being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public void setSampleRate(short rate) throws TinkerforgeException
TinkerforgeException
public short getSampleRate() throws TinkerforgeException
setSampleRate(short)
.TinkerforgeException
public void setCalibration(int[] offset, int[] gain) throws TinkerforgeException
TinkerforgeException
public BrickletIndustrialDualAnalogIn.Calibration getCalibration() throws TinkerforgeException
setCalibration(int[], int[])
.TinkerforgeException
public int[] getADCValues() throws TinkerforgeException
setCalibration(int[], int[])
.TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addVoltageListener(BrickletIndustrialDualAnalogIn.VoltageListener listener)
public void removeVoltageListener(BrickletIndustrialDualAnalogIn.VoltageListener listener)
public void addVoltageReachedListener(BrickletIndustrialDualAnalogIn.VoltageReachedListener listener)
public void removeVoltageReachedListener(BrickletIndustrialDualAnalogIn.VoltageReachedListener listener)
Copyright © 2022 Tinkerforge GmbH. All rights reserved.