Skip to main content
Control digital input/output pins for digital signaling and control.

Import

Methods

Method Reference

Net.get(name, type=NetType.GPIO)

Get a GPIO net by name.
Parameters: Returns: GPIO Net instance

input()

Read the digital state of the pin.
Returns: int - 0 for LOW, 1 for HIGH

output(level)

Set the digital state of the pin.

wait_for_level(level, timeout=None, ...)

Wait for the pin to reach a target level. Blocks until the pin reads the specified level or the timeout expires. The LabJack T7 uses hardware streaming at up to 20 kHz for fast edge detection. Other hardware uses software polling.
Parameters: Returns: float - Elapsed time in seconds until the level was detected Raises: TimeoutError if the timeout expires before the target level is reached Hardware-specific behavior:

Examples

Read Button State

Control LED

Wait for Interrupt

Button-Controlled LED

Toggle Output

Supported Hardware

Pin Naming

LabJack T7: MCC USB-202:

Multi-channel FTDI adapters

An FTDI net takes its channel from params.interface on the net record, accepting A-D or 0-3. A net with no interface uses channel A — the only choice on a single-channel FT232H. GPIO runs as asynchronous bitbang and needs no MPSSE engine, so every channel the part has is usable. Note the pin width differs: the FT232H and FT2232H expose ADBUS0-7 plus ACBUS0-7 (16 bits), while each FT4232H channel is 8 pins wide. See Nets for how channels are assigned across net types on one chip.

Notes

  • GPIO nets work directly without enable()/disable() calls
  • input() returns 0 or 1
  • output() accepts integers (0/1) or strings (“high”/“low”, “on”/“off”, “true”/“false”)
  • wait_for_level() blocks the calling thread until the target level is detected
  • LabJack T7 wait_for_level() uses hardware streaming for sub-millisecond detection
  • Net names must match those configured on the Lager Box