..
 #############################################################
 # 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-shell">Software</a> / Shell - Analog Out Bricklet

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

.. _analog_out_bricklet_shell:

Shell - Analog Out Bricklet
===========================

This is the description of the :ref:`Shell API bindings <api_bindings_shell>` for the :ref:`Analog Out Bricklet <analog_out_bricklet>`. General information and technical
specifications for the Analog Out Bricklet are summarized in its :ref:`hardware description
<analog_out_bricklet_description>`.

An :ref:`installation guide <api_bindings_shell_install>` for the Shell API
bindings is part of their general description.

.. _analog_out_bricklet_shell_examples:


Examples
--------

The example code below is `Public Domain (CC0 1.0)
<http://creativecommons.org/publicdomain/zero/1.0/>`__.

Simple
^^^^^^

`Download (example-simple.sh) <https://github.com/Tinkerforge/analog-out-bricklet/raw/master/software/examples/shell/example-simple.sh>`__

.. literalinclude:: AnalogOut_Bricklet_Shell_example-simple.sh
 :language: bash
 :linenos:
 :tab-width: 4

.. _analog_out_bricklet_shell_api:

API
---

Possible exit codes for all ``tinkerforge`` commands are:

* 1: interrupted (ctrl+c)
* 2: syntax error
* 21: Python 2.5 or newer is required
* 22: Python ``argparse`` module is missing
* 23: socket error
* 24: other exception
* 25: invalid placeholder in format string
* 26: authentication error
* 201: timeout occurred
* 209: invalid argument value
* 210: function is not supported
* 211: unknown error



Command Structure
^^^^^^^^^^^^^^^^^

The common options of the ``call`` and ``dispatch`` commands are documented
:ref:`here <ipcon_shell_api>`. The specific command structure is shown below.

.. sh:function:: X Stinkerforge Pcall Nanalog-out-bricklet A[<option>..] L<uid> L<function> L[<argument>..]

 :param <uid>: string
 :param <function>: string

 The ``call`` command is used to call a function of the Analog Out Bricklet. It can take several
 options:

 * ``--help`` shows help for the specific ``call`` command and exits
 * ``--list-functions`` shows a list of known functions of the Analog Out Bricklet and exits


.. sh:function:: X Stinkerforge Pdispatch Nanalog-out-bricklet A[<option>..] L<uid> L<callback>

 :param <uid>: string
 :param <callback>: string

 The ``dispatch`` command is used to dispatch a callback of the Analog Out Bricklet. It can
 take several options:

 * ``--help`` shows help for the specific ``dispatch`` command and exits
 * ``--list-callbacks`` shows a list of known callbacks of the Analog Out Bricklet and exits


.. sh:function:: X Stinkerforge Scall Panalog-out-bricklet L<uid> N<function> A[<option>..] L[<argument>..]

 :param <uid>: string
 :param <function>: string

 The ``<function>`` to be called can take different options depending of its
 kind. All functions can take the following options:

 * ``--help`` shows help for the specific function and exits

 Getter functions can take the following options:

 * ``--execute <command>`` shell command line to execute for each incoming
   response (see section about :ref:`output formatting <ipcon_shell_output>`
   for details)

 Setter functions can take the following options:

 * ``--expect-response`` requests response and waits for it

 The ``--expect-response`` option for setter functions allows to detect
 timeouts and other error conditions calls of setters as well. The device will
 then send a response for this purpose. If this option is not given for a
 setter function then no response is send and errors are silently ignored,
 because they cannot be detected.


.. sh:function:: X Stinkerforge Sdispatch Panalog-out-bricklet L<uid> N<callback> A[<option>..]

 :param <uid>: string
 :param <callback>: string

 The ``<callback>`` to be dispatched can take several options:

 * ``--help`` shows help for the specific callback and exits
 * ``--execute <command>`` shell command line to execute for each incoming
   response (see section about :ref:`output formatting <ipcon_shell_output>`
   for details)



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



.. sh:function:: tinkerforge call analog-out-bricklet <uid> set-voltage <voltage> 

 :param <voltage>: int

 :noreturn: no output

 Sets the voltage in mV. The possible range is 0V to 5V (0-5000).
 Calling this function will set the mode to 0 (see :sh:func:`set-mode <analog-out-bricklet set-mode>`).
 
 The default value is 0 (with mode 1).
 
.. sh:function:: tinkerforge call analog-out-bricklet <uid> get-voltage  


 :returns voltage: int

 Returns the voltage as set by :sh:func:`set-voltage <analog-out-bricklet set-voltage>`.
 
.. sh:function:: tinkerforge call analog-out-bricklet <uid> set-mode <mode> 

 :param <mode>: int (has symbols)

 :noreturn: no output

 Sets the mode of the analog value. Possible modes:
 
 * 0: Normal Mode (Analog value as set by :sh:func:`set-voltage <analog-out-bricklet set-voltage>` is applied)
 * 1: 1k Ohm resistor to ground
 * 2: 100k Ohm resistor to ground
 * 3: 500k Ohm resistor to ground
 
 Setting the mode to 0 will result in an output voltage of 0. You can jump
 to a higher output voltage directly by calling :sh:func:`set-voltage <analog-out-bricklet set-voltage>`.
 
 The default mode is 1.
 
 The following symbols are available for this function:
 
 * ``analog-value`` = 0, for <mode>
 * ``1k-to-ground`` = 1, for <mode>
 * ``100k-to-ground`` = 2, for <mode>
 * ``500k-to-ground`` = 3, for <mode>
 
.. sh:function:: tinkerforge call analog-out-bricklet <uid> get-mode  


 :returns mode: int (has symbols)

 Returns the mode as set by :sh:func:`set-mode <analog-out-bricklet set-mode>`.
 
 The following symbols are available for this function:
 
 * ``analog-value`` = 0, for mode
 * ``1k-to-ground`` = 1, for mode
 * ``100k-to-ground`` = 2, for mode
 * ``500k-to-ground`` = 3, for mode
 


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

.. sh:function:: tinkerforge call analog-out-bricklet <uid> get-identity  


 :returns uid: string
 :returns connected-uid: string
 :returns position: char
 :returns hardware-version: int,int,int
 :returns firmware-version: int,int,int
 :returns device-identifier: int (has symbols)

 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|
 


