pinget: Read the Status of an Input Pin
The application pinget
queries the current status of a pin. Changes to the value are displayed on the console.
Synopsis
- 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].
- -f, --frequency <period>
Frequency (period) of sending in ms [1000]
- --debug
Report additional debug info in log.
- -s, --severity <level>
Max severity (fatal|error|warning|info|debug|verbose) of log message.
- Arguments:
gpio identifier of the gpio.
Examples
Periodically Polling
The call ./pinget -a blackbox1 -s info -f 200 21
polls the user LED (GPIO #21) with a period of 200 ms. In this
example, the LED flashes and the changes are displayed on the console.
2024-05-01 09:35:45.561 NONE Press Ctrl-C to abort application.
2024-05-01 09:35:45.561 INFO Try to connect to blackbox1@51955...
2024-05-01 09:35:45.576 INFO Client is connected...
2024-05-01 09:35:45.583 INFO Session identifier 113, protocol version 0
2024-05-01 09:35:45.590 INFO Value changed: 0
2024-05-01 09:38:06.992 INFO Value changed: 1
2024-05-01 09:38:41.794 INFO Value changed: 0
2024-05-01 09:38:42.795 INFO Value changed: 1
2024-05-01 09:38:43.793 INFO Value changed: 0
2024-05-01 09:38:44.795 INFO Value changed: 1
The current value of the integrated light sensor (GPIO #22) can be queried in the same way
using ./pinget -a blackbox1 -s info -f 1000 22
. Changes are displayed on the console according to the
frequency (in this example, this is approx. 1 Hz).
2024-05-01 10:04:09.350 NONE Press Ctrl-C to abort application.
2024-05-01 10:04:09.351 INFO Try to connect to blackbox1@51955...
2024-05-01 10:04:09.407 INFO Client is connected...
2024-05-01 10:04:09.415 INFO Session identifier 118, protocol version 0
2024-05-01 10:04:09.421 INFO Value changed: 1502
2024-05-01 10:04:10.460 INFO Value changed: 1507
2024-05-01 10:04:11.506 INFO Value changed: 1513
2024-05-01 10:04:12.559 INFO Value changed: 1470
2024-05-01 10:04:13.436 INFO Value changed: 378
2024-05-01 10:04:14.480 INFO Value changed: 1490
2024-05-01 10:04:15.531 INFO Value changed: 1519
2024-05-01 10:04:16.425 INFO Value changed: 1506
2024-05-01 10:04:17.426 INFO Value changed: 919
2024-05-01 10:04:18.424 INFO Value changed: 1035
Single Value
If the parameter -f 0
is passed, the current value of the pin is queried once and displayed on the console (complete
parameter set: ./pinget -a blackbox1 -s info -f 0 22
).