NAME

Tinkerforge::BrickletIndustrialDual020mA - Device for sensing two currents between 0 and 20mA (IEC 60381-1)

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Industrial Dual 0-20mA Bricklet.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

CALLBACK_CURRENT

This constant is used with the register_callback() subroutine to specify the CALLBACK_CURRENT callback.

CALLBACK_CURRENT_REACHED

This constant is used with the register_callback() subroutine to specify the CALLBACK_CURRENT_REACHED callback.

FUNCTION_GET_CURRENT

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CURRENT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CURRENT_CALLBACK_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_DEBOUNCE_PERIOD

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_SAMPLE_RATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SAMPLE_RATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

get_current()

Returns the current of the specified sensor (0 or 1). The value is in nA and between 0nA and 22505322nA (22.5mA).

It is possible to detect if an IEC 60381-1 compatible sensor is connected and if it works probably.

If the returned current is below 4mA, there is likely no sensor connected or the sensor may be defect. If the returned current is over 20mA, there might be a short circuit or the sensor may be defect.

If you want to get the current periodically, it is recommended to use the callback :func:`Current` and set the period with :func:`SetCurrentCallbackPeriod`.

set_current_callback_period()

Sets the period in ms with which the :func:`Current` callback is triggered periodically for the given sensor. A value of 0 turns the callback off.

:func:`Current` is only triggered if the current has changed since the last triggering.

The default value is 0.

get_current_callback_period()

Returns the period as set by :func:`SetCurrentCallbackPeriod`.

set_current_callback_threshold()

Sets the thresholds for the :func:`CurrentReached` callback for the given sensor.

The following options are possible:

.. csv-table:: :header: "Option", "Description" :widths: 10, 100

"'x'",    "Callback is turned off"
"'o'",    "Callback is triggered when the current is *outside* the min and max values"
"'i'",    "Callback is triggered when the current is *inside* the min and max values"
"'<'",    "Callback is triggered when the current is smaller than the min value (max is ignored)"
"'>'",    "Callback is triggered when the current is greater than the min value (max is ignored)"

The default value is ('x', 0, 0).

get_current_callback_threshold()

Returns the threshold as set by :func:`SetCurrentCallbackThreshold`.

set_debounce_period()

Sets the period in ms with which the threshold callback

* :func:`CurrentReached`

is triggered, if the threshold

* :func:`SetCurrentCallbackThreshold`

keeps being reached.

The default value is 100.

get_debounce_period()

Returns the debounce period as set by :func:`SetDebouncePeriod`.

set_sample_rate()

Sets the sample rate to either 240, 60, 15 or 4 samples per second. The resolution for the rates is 12, 14, 16 and 18 bit respectively.

.. csv-table:: :header: "Value", "Description" :widths: 10, 100

"0",    "240 samples per second, 12 bit resolution"
"1",    "60 samples per second, 14 bit resolution"
"2",    "15 samples per second, 16 bit resolution"
"3",    "4 samples per second, 18 bit resolution"

The default value is 3: 4 samples per second with 18 bit resolution.

get_sample_rate()

Returns the sample rate as set by :func:`SetSampleRate`.

get_identity()

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' or 'd'.

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|