Fibstack Command Line Interface

The FibStack CLI tool allows you to control the PiSwitcher Plus boards from the command line.

You can also write shell/bash scripts to interact with the board. If you are interested in writing programs, please consult the Getting Started Guide page for C and Python program examples.

The FibStack CLI tool has the following command options:

--list-boards, -l - List all the connected PiSwitcher boards.
--board, -b - The board index. If you specify only this parameter, then it will show the board information. You cannot use it with --address, -a option.
--address, -a - The board I2C address. If you specify only this parameter, then it will show the board information. You cannot use it with --board, -b option.
--device, -d - Specifies the device ID. If you don’t specify the --set, -s option, this will show the device value.
--set, -s - If you specify the --device, -d option, this specifies the new value to be assigned to the device. Otherwise, it specifies the board’s new I2C address.

Examples

List all connected boards

In the terminal run fibstack --list-borads or fibstack -l.

$ fibstack --list-boards
Total boards found: 2
 Id   Address    Devices    Descriptions
-----------------------------------------------------------
  0  80(0X50)          8    FibStack PiSwitcher Plus. Four relay switches and four 12-bit ADC converters.
  1  83(0X53)          8    FibStack PiSwitcher Plus. Four relay switches and four 12-bit ADC converters.

Show board information

To display board information, specify the board index or the board address: fibstack -b0 or fibstack -a80. You can also specify the address in the hexadecimal format.

$ fibstack -a0x50
I2C address 80(0X50)
Description: FibStack PiSwitcher Plus. Four relay switches and four 12-bit ADC converters.
Total devices: 8
 ID  Value Type  Value  Read Only  Description
------------------------------------------------
  0     BOOLEAN      0         No  Relay Switch
  1     BOOLEAN      0         No  Relay Switch
  2     BOOLEAN      0         No  Relay Switch
  3     BOOLEAN      0         No  Relay Switch
  4     INTEGER   1297        Yes  12-bit ADC Converter
  5     INTEGER   1298        Yes  12-bit ADC Converter
  6     INTEGER   1299        Yes  12-bit ADC Converter
  7     INTEGER   1295        Yes  12-bit ADC Converter

Change board address

To change the board I2C address, specify the --set -s option with the new address value. Make sure the new address is not in use by another board.

$ fibstack --address=80 --set=81
SUCCESS: The new address was set successfully

Show device information

To show only the information about a specific device, specify the device id option.

$ fibstack -b0 -d 4
12-bit ADC Converter. ID: 4, Value = 1304, Read Only

Set device value

To set the device value, along with the device ID option, specify the new value with the --set -s option. The following command will switch on the first switch relay device.

$ fibstack -b0 -d0 -s1

You will get an error if the device is read-only, or the value is invalid.