pinset: Set Digital Output Pin

A digital output can be set or deleted with the application pinset. By specifying the parameters accordingly, the output can be changed interactively by the user or automatically with a fixed frequency.

Note

The pin used must have been configured as a digital output beforehand using systemset.

Synopsis

Usage: ./pinset [options] gpio
Client app connecting to ‘Black-Box’ device for test purposes.
Options:
-h, --help

Displays help on commandline options.

--help-all

Displays help, including generic Qt options.

-v, --version

Displays version information.

-a, --address <host>

Host address of the gateway [localhost].

-p, --port <port>

Port of the gateway [51955].

-s, --severity <level>

Max severity (fatal|error|warning|info|debug|verbose) of log message.

-f, --frequency <period>

Frequency (period) of sending in ms [1000]

--debug

Report additional debug info in log.

--value

Value (0|1) to be set/cleared.

-t, --toggle

Toggle the value with given frequency

Arguments:

gpio identifier of the gpio.

Examples

Interactive Mode

In the first example, using ./pinset -a blackbox1 -s info 21 the interactive mode is started. The user can set or clear the user LED (GPIO #21) via a console input, as the following snippet shows.

Note

The user LED has an inverted logic, which means that 1 switches the LED off and 0 switches the LED on.

2024-04-30 14:27:10.648 NONE  Press Ctrl-C to abort application.
2024-04-30 14:27:10.648 INFO  Try to connect to blackbox1@51955...
2024-04-30 14:27:10.667 INFO  Client is connected...
2024-04-30 14:27:10.674 INFO  Session identifier 2, protocol version 0
2024-04-30 14:27:10.674 INFO  Enter 0 or 1 to clear/set the GPIO.
1
0

Toggle Mode

In the second example, the parameters ./pinset -a blackbox1 -s info --value 0 -t -f 100 21 are used to periodically switch the user LED on and off (classical blinky-example). The parameter following --value specifies the first value, which is then inverted with a period of 100 ms.

If the parameter -s info is omitted, the sending of requests and receiving of responses can be viewed in the console outputs. The following trace shows that the messages are sent at the times 116, 216, 316 and 416 (milliseconds fraction).

2024-04-30 20:28:08.971 VERB  Severity level is set to VERB
2024-04-30 20:28:08.971 NONE  Press Ctrl-C to abort application.
2024-04-30 20:28:08.971 INFO  Set/clear GPIO #21
2024-04-30 20:28:08.971 INFO  Try to connect to blackbox1@51955...
2024-04-30 20:28:09.111 INFO  Client is connected...
2024-04-30 20:28:09.116 INFO  Session identifier 48, protocol version 0
2024-04-30 20:28:09.116 DEBUG Prepared message session:48, message id:0, modelrpc id:0
2024-04-30 20:28:09.117 DEBUG Write message 48@0, length=10
2024-04-30 20:28:09.125 DEBUG Received acknowledgement result message.
2024-04-30 20:28:09.216 DEBUG Prepared message session:48, message id:1, modelrpc id:1
2024-04-30 20:28:09.217 DEBUG Write message 48@1, length=12
2024-04-30 20:28:09.224 DEBUG Received acknowledgement result message.
2024-04-30 20:28:09.316 DEBUG Prepared message session:48, message id:2, modelrpc id:2
2024-04-30 20:28:09.317 DEBUG Write message 48@2, length=12
2024-04-30 20:28:09.323 DEBUG Received acknowledgement result message.
2024-04-30 20:28:09.416 DEBUG Prepared message session:48, message id:3, modelrpc id:3
2024-04-30 20:28:09.417 DEBUG Write message 48@3, length=12
2024-04-30 20:28:09.423 DEBUG Received acknowledgement result message.

Single Mode

This example shows how a digital output pin is set or cleared once. Calling ./pinset -a blackbox1 -s info --value 0 -f 0 21 clears the GPIO #21. In contrast using --value 1 sets the given pin. The parameter -f 0 ends the application after the pin has been cleared/set once.