Ishraq Ibne Ashraf
and 1 contributors

NAME

Tinkerforge::BrickletDualButton - Two tactile buttons with built-in blue LEDs

CONSTANTS

DEVICE_IDENTIFIER

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

CALLBACK_STATE_CHANGED

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

FUNCTION_SET_LED_STATE

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

FUNCTION_GET_LED_STATE

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

FUNCTION_GET_BUTTON_STATE

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

FUNCTION_SET_SELECTED_LED_STATE

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

set_led_state()

Sets the state of the LEDs. Possible states are:

* 0 = AutoToggleOn: Enables auto toggle with initially enabled LED. * 1 = AutoToggleOff: Activates auto toggle with initially disabled LED. * 2 = On: Enables LED (auto toggle is disabled). * 3 = Off: Disables LED (auto toggle is disabled).

In auto toggle mode the LED is toggled automatically at each press of a button.

If you just want to set one of the LEDs and don't know the current state of the other LED, you can get the state with :func:`Get LED State` or you can use :func:`Set Selected LED State`.

The default value is (1, 1).

get_led_state()

Returns the current state of the LEDs, as set by :func:`Set LED State`.

get_button_state()

Returns the current state for both buttons. Possible states are:

* 0 = pressed * 1 = released

set_selected_led_state()

Sets the state of the selected LED (0 or 1).

The other LED remains untouched.

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|