..
 #############################################################
 # This file was automatically generated on 2015-05-08.      #
 #                                                           #
 # If you have a bugfix for this file and want to commit it, #
 # please fix the bug in the generator. You can find a link  #
 # to the generators git repository on tinkerforge.com       #
 #############################################################

:orphan:
:breadcrumbs: <a href="../../index.html">Home</a> / <a href="../../index.html#software-tcpip">Software</a> / TCP/IP - Accelerometer Bricklet

.. |device_identifier_constant| unicode:: 0xA0
   :trim:

.. _accelerometer_bricklet_tcpip:

TCP/IP - Accelerometer Bricklet
===============================

.. note::
 This Bricklet is currently in the prototype stage and the software/hardware
 as well as the documentation is in an incomplete state.


This is the description of the :ref:`TCP/IP protocol <llproto_tcpip>` for the :ref:`Accelerometer Bricklet <accelerometer_bricklet>`. General information and technical
specifications for the Accelerometer Bricklet are summarized in its :ref:`hardware description
<accelerometer_bricklet_description>`.

.. _accelerometer_bricklet_tcpip_api:

API
---

A general description of the TCP/IP protocol structure can be found
:ref:`here <llproto_tcpip>`.




Basic Functions
^^^^^^^^^^^^^^^



.. tcpip:function:: BrickletAccelerometer.get_acceleration

 :functionid: 1
 :emptyrequest: empty payload

 :response x: int16
 :response y: int16
 :response z: int16

 Returns the acceleration in x, y and z direction. The values
 are given in mG (1/1000 G).
 
 If you want to get the acceleration periodically, it is recommended 
 to use the callback :tcpip:func:`CALLBACK_ACCELERATION <BrickletAccelerometer.CALLBACK_ACCELERATION>` and set the period with 
 :tcpip:func:`set_acceleration_callback_period <BrickletAccelerometer.set_acceleration_callback_period>`.
 
.. tcpip:function:: BrickletAccelerometer.get_temperature

 :functionid: 8
 :emptyrequest: empty payload

 :response temperature: int16

 Returns the temperature of the accelerometer in °C.
 
.. tcpip:function:: BrickletAccelerometer.led_on

 :functionid: 11
 :emptyrequest: empty payload

 :noresponse: no response

 Enables the LED on the Bricklet.
 
.. tcpip:function:: BrickletAccelerometer.led_off

 :functionid: 12
 :emptyrequest: empty payload

 :noresponse: no response

 Disables the LED on the Bricklet.
 
.. tcpip:function:: BrickletAccelerometer.is_led_on

 :functionid: 13
 :emptyrequest: empty payload

 :response value: uint8

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


Advanced Functions
^^^^^^^^^^^^^^^^^^

.. tcpip:function:: BrickletAccelerometer.set_configuration

 :functionid: 9
 :request data_rate: uint8
 :request full_scale: uint8
 :request filter_bandwidth: uint8

 :noresponse: no response

 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.
 
.. tcpip:function:: BrickletAccelerometer.get_configuration

 :functionid: 10
 :emptyrequest: empty payload

 :response data_rate: uint8
 :response full_scale: uint8
 :response filter_bandwidth: uint8

 Returns the configuration as set by :tcpip:func:`set_configuration <BrickletAccelerometer.set_configuration>`.
 
.. tcpip:function:: BrickletAccelerometer.get_identity

 :functionid: 255
 :emptyrequest: empty payload

 :response uid: char[8]
 :response connected_uid: char[8]
 :response position: char
 :response hardware_version: uint8[3]
 :response firmware_version: uint8[3]
 :response device_identifier: uint16

 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|
 


Callback Configuration Functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



.. tcpip:function:: BrickletAccelerometer.set_acceleration_callback_period

 :functionid: 2
 :request period: uint32

 :noresponse: no response

 Sets the period in ms with which the :tcpip:func:`CALLBACK_ACCELERATION <BrickletAccelerometer.CALLBACK_ACCELERATION>` callback is triggered
 periodically. A value of 0 turns the callback off.
 
 :tcpip:func:`CALLBACK_ACCELERATION <BrickletAccelerometer.CALLBACK_ACCELERATION>` is only triggered if the acceleration has changed since the
 last triggering.
 
 The default value is 0.
 
.. tcpip:function:: BrickletAccelerometer.get_acceleration_callback_period

 :functionid: 3
 :emptyrequest: empty payload

 :response period: uint32

 Returns the period as set by :tcpip:func:`set_acceleration_callback_period <BrickletAccelerometer.set_acceleration_callback_period>`.
 
.. tcpip:function:: BrickletAccelerometer.set_acceleration_callback_threshold

 :functionid: 4
 :request option: char
 :request min_x: int16
 :request max_x: int16
 :request min_y: int16
 :request max_y: int16
 :request min_z: int16
 :request max_z: int16

 :noresponse: no response

 Sets the thresholds for the :tcpip:func:`CALLBACK_ACCELERATION_REACHED <BrickletAccelerometer.CALLBACK_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 temperature is *outside* the min and max values"
  "'i'",    "Callback is triggered when the temperature is *inside* the min and max values"
  "'<'",    "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
  "'>'",    "Callback is triggered when the temperature is greater than the min value (max is ignored)"
 
 The default value is ('x', 0, 0, 0, 0, 0, 0).
 
.. tcpip:function:: BrickletAccelerometer.get_acceleration_callback_threshold

 :functionid: 5
 :emptyrequest: empty payload

 :response option: char
 :response min_x: int16
 :response max_x: int16
 :response min_y: int16
 :response max_y: int16
 :response min_z: int16
 :response max_z: int16

 Returns the threshold as set by :tcpip:func:`set_acceleration_callback_threshold <BrickletAccelerometer.set_acceleration_callback_threshold>`.
 
.. tcpip:function:: BrickletAccelerometer.set_debounce_period

 :functionid: 6
 :request debounce: uint32

 :noresponse: no response

 Sets the period in ms with which the threshold callback
 
 * :tcpip:func:`CALLBACK_ACCELERATION_REACHED <BrickletAccelerometer.CALLBACK_ACCELERATION_REACHED>`
 
 is triggered, if the threshold
 
 * :tcpip:func:`set_acceleration_callback_threshold <BrickletAccelerometer.set_acceleration_callback_threshold>`
 
 keeps being reached.
 
 The default value is 100.
 
.. tcpip:function:: BrickletAccelerometer.get_debounce_period

 :functionid: 7
 :emptyrequest: empty payload

 :response debounce: uint32

 Returns the debounce period as set by :tcpip:func:`set_debounce_period <BrickletAccelerometer.set_debounce_period>`.
 


.. _accelerometer_bricklet_tcpip_callbacks:

Callbacks
^^^^^^^^^

.. tcpip:function:: BrickletAccelerometer.CALLBACK_ACCELERATION

 :functionid: 14

 :response x: int16
 :response y: int16
 :response z: int16


 This callback is triggered periodically with the period that is set by
 :tcpip:func:`set_acceleration_callback_period <BrickletAccelerometer.set_acceleration_callback_period>`. The response values are the
 X, Y and Z acceleration.
 
 :tcpip:func:`CALLBACK_ACCELERATION <BrickletAccelerometer.CALLBACK_ACCELERATION>` is only triggered if the acceleration has changed since the
 last triggering.
 
.. tcpip:function:: BrickletAccelerometer.CALLBACK_ACCELERATION_REACHED

 :functionid: 15

 :response x: int16
 :response y: int16
 :response z: int16


 This callback is triggered when the threshold as set by
 :tcpip:func:`set_acceleration_callback_threshold <BrickletAccelerometer.set_acceleration_callback_threshold>` is reached.
 The response values are the X, Y and Z acceleration.
 
 If the threshold keeps being reached, the callback is triggered periodically
 with the period as set by :tcpip:func:`set_debounce_period <BrickletAccelerometer.set_debounce_period>`.
 


