Skip to main content
Read the digital input state of GPIO pins.

Syntax

lager gpi [NETNAME] [OPTIONS]

Arguments

ArgumentDescription
NETNAMEGPIO net name (optional if default is set)

Options

OptionDescription
--box BOXLagerbox name or IP address

Usage

# Read input state
lager gpi BUTTON1 --box my-lager-box

# Using default net
lager gpi

Output

Returns the digital state:
  • 0 - Low (0V)
  • 1 - High (3.3V or 5V depending on hardware)
$ lager gpi BUTTON1
1

Supported Hardware

DevicePinsVoltage
LabJack T7FIO0-FIO73.3V logic

Examples

# Check if button is pressed
STATE=$(lager gpi BUTTON1 --box lab-gw)
if [ "$STATE" -eq "1" ]; then
    echo "Button pressed"
fi

# Read multiple inputs
lager gpi BUTTON1 --box lab-gw
lager gpi SENSOR_INT --box lab-gw
lager gpi FAULT_PIN --box lab-gw


Notes

  • GPI is for reading input pins only
  • Use lager gpo to set output pins
  • Default net can be set with lager defaults add --gpio-net
  • Pin must be configured as input in net configuration