Ishraq Ibne Ashraf

NAME

Tinkerforge::BrickletAccelerometer - Measures acceleration in three axis

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Accelerometer 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.

DEVICE_DISPLAY_NAME

This constant represents the display name of a Accelerometer Bricklet.

CALLBACK_ACCELERATION

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

CALLBACK_ACCELERATION_REACHED

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

FUNCTION_GET_ACCELERATION

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

FUNCTION_SET_ACCELERATION_CALLBACK_PERIOD

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

FUNCTION_GET_ACCELERATION_CALLBACK_PERIOD

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

FUNCTION_SET_ACCELERATION_CALLBACK_THRESHOLD

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

FUNCTION_GET_ACCELERATION_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_GET_TEMPERATURE

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

FUNCTION_SET_CONFIGURATION

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

FUNCTION_GET_CONFIGURATION

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

FUNCTION_LED_ON

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

FUNCTION_LED_OFF

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

FUNCTION_IS_LED_ON

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_acceleration()

Returns the acceleration in x, y and z direction. The values are given in g/1000 (1g = 9.80665m/s²), not to be confused with grams.

If you want to get the acceleration periodically, it is recommended to use the :cb:`Acceleration` callback and set the period with :func:`Set Acceleration Callback Period`.

set_acceleration_callback_period()

Sets the period in ms with which the :cb:`Acceleration` callback is triggered periodically. A value of 0 turns the callback off.

The :cb:`Acceleration` callback is only triggered if the acceleration has changed since the last triggering.

The default value is 0.

get_acceleration_callback_period()

Returns the period as set by :func:`Set Acceleration Callback Period`.

set_acceleration_callback_threshold()

Sets the thresholds for the :cb:`Acceleration Reached` callback.

The following options are possible:

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

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

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

get_acceleration_callback_threshold()

Returns the threshold as set by :func:`Set Acceleration Callback Threshold`.

set_debounce_period()

Sets the period in ms with which the threshold callback

* :cb:`Acceleration Reached`

is triggered, if the threshold

* :func:`Set Acceleration Callback Threshold`

keeps being reached.

The default value is 100.

get_debounce_period()

Returns the debounce period as set by :func:`Set Debounce Period`.

get_temperature()

Returns the temperature of the accelerometer in °C.

set_configuration()

Configures the data rate, full scale range and filter bandwidth. Possible values are:

* Data rate of 0Hz to 1600Hz. * Full scale range of -2G to +2G up to -16G to +16G. * Filter bandwidth between 50Hz and 800Hz.

Decreasing data rate or full scale range will also decrease the noise on the data.

The default values are 100Hz data rate, -4G to +4G range and 200Hz filter bandwidth.

get_configuration()

Returns the configuration as set by :func:`Set Configuration`.

led_on()

Enables the LED on the Bricklet.

led_off()

Disables the LED on the Bricklet.

is_led_on()

Returns *true* if the LED is enabled, *false* otherwise.

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|