Package com.tinkerforge
Class BrickletVoltageCurrent
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletVoltageCurrent
-
public class BrickletVoltageCurrent extends Device
Measures power, DC voltage and DC current up to 720W/36V/20A
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BrickletVoltageCurrent(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT
public static final byte FUNCTION_GET_CURRENT
- See Also:
- Constant Field Values
-
FUNCTION_GET_VOLTAGE
public static final byte FUNCTION_GET_VOLTAGE
- See Also:
- Constant Field Values
-
FUNCTION_GET_POWER
public static final byte FUNCTION_GET_POWER
- See Also:
- Constant Field Values
-
FUNCTION_SET_CONFIGURATION
public static final byte FUNCTION_SET_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_CONFIGURATION
public static final byte FUNCTION_GET_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_CALIBRATION
public static final byte FUNCTION_SET_CALIBRATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_CALIBRATION
public static final byte FUNCTION_GET_CALIBRATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_CURRENT_CALLBACK_PERIOD
public static final byte FUNCTION_SET_CURRENT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_CALLBACK_PERIOD
public static final byte FUNCTION_GET_CURRENT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_POWER_CALLBACK_PERIOD
public static final byte FUNCTION_SET_POWER_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_POWER_CALLBACK_PERIOD
public static final byte FUNCTION_GET_POWER_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_SET_POWER_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_POWER_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_POWER_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_POWER_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
AVERAGING_1
public static final short AVERAGING_1
- See Also:
- Constant Field Values
-
AVERAGING_4
public static final short AVERAGING_4
- See Also:
- Constant Field Values
-
AVERAGING_16
public static final short AVERAGING_16
- See Also:
- Constant Field Values
-
AVERAGING_64
public static final short AVERAGING_64
- See Also:
- Constant Field Values
-
AVERAGING_128
public static final short AVERAGING_128
- See Also:
- Constant Field Values
-
AVERAGING_256
public static final short AVERAGING_256
- See Also:
- Constant Field Values
-
AVERAGING_512
public static final short AVERAGING_512
- See Also:
- Constant Field Values
-
AVERAGING_1024
public static final short AVERAGING_1024
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_OFF
public static final char THRESHOLD_OPTION_OFF
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_OUTSIDE
public static final char THRESHOLD_OPTION_OUTSIDE
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_INSIDE
public static final char THRESHOLD_OPTION_INSIDE
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_SMALLER
public static final char THRESHOLD_OPTION_SMALLER
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_GREATER
public static final char THRESHOLD_OPTION_GREATER
- See Also:
- Constant Field Values
-
CONVERSION_TIME_140US
public static final short CONVERSION_TIME_140US
- See Also:
- Constant Field Values
-
CONVERSION_TIME_204US
public static final short CONVERSION_TIME_204US
- See Also:
- Constant Field Values
-
CONVERSION_TIME_332US
public static final short CONVERSION_TIME_332US
- See Also:
- Constant Field Values
-
CONVERSION_TIME_588US
public static final short CONVERSION_TIME_588US
- See Also:
- Constant Field Values
-
CONVERSION_TIME_1_1MS
public static final short CONVERSION_TIME_1_1MS
- See Also:
- Constant Field Values
-
CONVERSION_TIME_2_116MS
public static final short CONVERSION_TIME_2_116MS
- See Also:
- Constant Field Values
-
CONVERSION_TIME_4_156MS
public static final short CONVERSION_TIME_4_156MS
- See Also:
- Constant Field Values
-
CONVERSION_TIME_8_244MS
public static final short CONVERSION_TIME_8_244MS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletVoltageCurrent
public BrickletVoltageCurrent(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
getCurrent
public int getCurrent() throws TinkerforgeException
Returns the current. If you want to get the current periodically, it is recommended to use theBrickletVoltageCurrent.CurrentListener
listener and set the period withsetCurrentCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
getVoltage
public int getVoltage() throws TinkerforgeException
Returns the voltage. If you want to get the voltage periodically, it is recommended to use theBrickletVoltageCurrent.VoltageListener
listener and set the period withsetVoltageCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
getPower
public int getPower() throws TinkerforgeException
Returns the power. If you want to get the power periodically, it is recommended to use theBrickletVoltageCurrent.PowerListener
listener and set the period withsetPowerCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setConfiguration
public void setConfiguration(short averaging, short voltageConversionTime, short currentConversionTime) throws TinkerforgeException
Sets the configuration of the Voltage/Current Bricklet. It is possible to configure number of averages as well as voltage and current conversion time.- Throws:
TinkerforgeException
-
getConfiguration
public BrickletVoltageCurrent.Configuration getConfiguration() throws TinkerforgeException
Returns the configuration as set bysetConfiguration(short, short, short)
.- Throws:
TinkerforgeException
-
setCalibration
public void setCalibration(int gainMultiplier, int gainDivisor) throws TinkerforgeException
Since the shunt resistor that is used to measure the current is not perfectly precise, it needs to be calibrated by a multiplier and divisor if a very precise reading is needed. For example, if you are expecting a measurement of 1000mA and you are measuring 1023mA, you can calibrate the Voltage/Current Bricklet by setting the multiplier to 1000 and the divisor to 1023.- Throws:
TinkerforgeException
-
getCalibration
public BrickletVoltageCurrent.Calibration getCalibration() throws TinkerforgeException
Returns the calibration as set bysetCalibration(int, int)
.- Throws:
TinkerforgeException
-
setCurrentCallbackPeriod
public void setCurrentCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletVoltageCurrent.CurrentListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletVoltageCurrent.CurrentListener
listener is only triggered if the current has changed since the last triggering.- Throws:
TinkerforgeException
-
getCurrentCallbackPeriod
public long getCurrentCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetCurrentCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setVoltageCallbackPeriod
public void setVoltageCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletVoltageCurrent.VoltageListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletVoltageCurrent.VoltageListener
listener is only triggered if the voltage has changed since the last triggering.- Throws:
TinkerforgeException
-
getVoltageCallbackPeriod
public long getVoltageCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetVoltageCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setPowerCallbackPeriod
public void setPowerCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletVoltageCurrent.PowerListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletVoltageCurrent.PowerListener
listener is only triggered if the power has changed since the last triggering.- Throws:
TinkerforgeException
-
getPowerCallbackPeriod
public long getPowerCallbackPeriod() throws TinkerforgeException
Returns the period as set bygetPowerCallbackPeriod()
.- Throws:
TinkerforgeException
-
setCurrentCallbackThreshold
public void setCurrentCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletVoltageCurrent.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)" \endverbatim- Throws:
TinkerforgeException
-
getCurrentCallbackThreshold
public BrickletVoltageCurrent.CurrentCallbackThreshold getCurrentCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetCurrentCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setVoltageCallbackThreshold
public void setVoltageCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletVoltageCurrent.VoltageReachedListener
listener. 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)" \endverbatim- Throws:
TinkerforgeException
-
getVoltageCallbackThreshold
public BrickletVoltageCurrent.VoltageCallbackThreshold getVoltageCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetVoltageCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setPowerCallbackThreshold
public void setPowerCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletVoltageCurrent.PowerReachedListener
listener. The following options are possible: \verbatim "Option", "Description" "'x'", "Listener is turned off" "'o'", "Listener is triggered when the power is *outside* the min and max values" "'i'", "Listener is triggered when the power is *inside* the min and max values" "'<'", "Listener is triggered when the power is smaller than the min value (max is ignored)" "'>'", "Listener is triggered when the power is greater than the min value (max is ignored)" \endverbatim- Throws:
TinkerforgeException
-
getPowerCallbackThreshold
public BrickletVoltageCurrent.PowerCallbackThreshold getPowerCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetPowerCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setDebouncePeriod
public void setDebouncePeriod(long debounce) throws TinkerforgeException
Sets the period with which the threshold listeners *BrickletVoltageCurrent.CurrentReachedListener
, *BrickletVoltageCurrent.VoltageReachedListener
, *BrickletVoltageCurrent.PowerReachedListener
are triggered, if the thresholds *setCurrentCallbackThreshold(char, int, int)
, *setVoltageCallbackThreshold(char, int, int)
, *setPowerCallbackThreshold(char, int, int)
keep being reached.- Throws:
TinkerforgeException
-
getDebouncePeriod
public long getDebouncePeriod() throws TinkerforgeException
Returns the debounce period as set bysetDebouncePeriod(long)
.- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addCurrentListener
public void addCurrentListener(BrickletVoltageCurrent.CurrentListener listener)
Adds a Current listener.
-
removeCurrentListener
public void removeCurrentListener(BrickletVoltageCurrent.CurrentListener listener)
Removes a Current listener.
-
addVoltageListener
public void addVoltageListener(BrickletVoltageCurrent.VoltageListener listener)
Adds a Voltage listener.
-
removeVoltageListener
public void removeVoltageListener(BrickletVoltageCurrent.VoltageListener listener)
Removes a Voltage listener.
-
addPowerListener
public void addPowerListener(BrickletVoltageCurrent.PowerListener listener)
Adds a Power listener.
-
removePowerListener
public void removePowerListener(BrickletVoltageCurrent.PowerListener listener)
Removes a Power listener.
-
addCurrentReachedListener
public void addCurrentReachedListener(BrickletVoltageCurrent.CurrentReachedListener listener)
Adds a CurrentReached listener.
-
removeCurrentReachedListener
public void removeCurrentReachedListener(BrickletVoltageCurrent.CurrentReachedListener listener)
Removes a CurrentReached listener.
-
addVoltageReachedListener
public void addVoltageReachedListener(BrickletVoltageCurrent.VoltageReachedListener listener)
Adds a VoltageReached listener.
-
removeVoltageReachedListener
public void removeVoltageReachedListener(BrickletVoltageCurrent.VoltageReachedListener listener)
Removes a VoltageReached listener.
-
addPowerReachedListener
public void addPowerReachedListener(BrickletVoltageCurrent.PowerReachedListener listener)
Adds a PowerReached listener.
-
removePowerReachedListener
public void removePowerReachedListener(BrickletVoltageCurrent.PowerReachedListener listener)
Removes a PowerReached listener.
-
-