1#!/bin/sh 2# Connects to localhost:4223 by default, use --host and --port to change this 3 4uid=XYZ# Change XYZ to the UID of your Dual Button Bricklet 5 6# Handle incoming state changed callbacks 7tinkerforgedispatchdual-button-bricklet$uidstate-changed& 8 9echo"Press key to exit";readdummy
1011kill---$$# Stop callback dispatch in background
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 output formatting
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 sent and errors are silently ignored,
because they cannot be detected.
<led-l> – Type: Int, Range: See symbols, Default: 1
<led-r> – Type: Int, Range: See symbols, Default: 1
Output:
no output
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 get-led-state or you
can use set-selected-led-state.
The following symbols are available for this function:
Using callbacks for recurring events is always preferred
compared to using getters. It will use less USB bandwidth and the latency
will be a lot better, since there is no round trip time.