..
 #############################################################
 # 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       #
 #############################################################


:breadcrumbs: <a href="../../index.html">Home</a> / <a href="../../index.html#software-modbus">Software</a> / Modbus - Tilt Bricklet

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

.. _tilt_bricklet_modbus:

Modbus - Tilt Bricklet
======================

This is the description of the :ref:`Modbus protocol <llproto_modbus>` for the :ref:`Tilt Bricklet <tilt_bricklet>`. General information and technical
specifications for the Tilt Bricklet are summarized in its :ref:`hardware description
<tilt_bricklet_description>`.

.. _tilt_bricklet_modbus_api:

API
---

A general description of the Modbus protocol structure can be found
:ref:`here <llproto_modbus>`.




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



.. modbus:function:: BrickletTilt.get_tilt_state

 :functionid: 1
 :emptyrequest: empty payload

 :response state: uint8

 Returns the current tilt state. The state can either be
 
 * 0 = Closed: The ball in the tilt switch closes the circuit.
 * 1 = Open: The ball in the tilt switch does not close the circuit.
 * 2 = Closed Vibrating: The tilt switch is in motion (rapid change between open and close).
 
 .. image:: /Images/Bricklets/bricklet_tilt_mechanics.jpg
    :scale: 100 %
    :alt: Tilt states
    :align: center
    :target: ../../_images/Bricklets/bricklet_tilt_mechanics.jpg
 
 


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

.. modbus:function:: BrickletTilt.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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



.. modbus:function:: BrickletTilt.enable_tilt_state_callback

 :functionid: 2
 :emptyrequest: empty payload

 :noresponse: no response

 Enables the :modbus:func:`CALLBACK_TILT_STATE <BrickletTilt.CALLBACK_TILT_STATE>` callback.
 
.. modbus:function:: BrickletTilt.disable_tilt_state_callback

 :functionid: 3
 :emptyrequest: empty payload

 :noresponse: no response

 Disables the :modbus:func:`CALLBACK_TILT_STATE <BrickletTilt.CALLBACK_TILT_STATE>` callback.
 
.. modbus:function:: BrickletTilt.is_tilt_state_callback_enabled

 :functionid: 4
 :emptyrequest: empty payload

 :response enabled: bool

 Returns *true* if the :modbus:func:`CALLBACK_TILT_STATE <BrickletTilt.CALLBACK_TILT_STATE>` callback is enabled.
 


.. _tilt_bricklet_modbus_callbacks:

Callbacks
^^^^^^^^^

.. modbus:function:: BrickletTilt.CALLBACK_TILT_STATE

 :functionid: 5

 :response state: uint8


 This callback provides the current tilt state. It is called every time the
 state changes.
 
 See :modbus:func:`get_tilt_state <BrickletTilt.get_tilt_state>` for a description of the states.
 


