Import
Methods
Method Reference
Net.get(name, type=NetType.GPIO)
Get a GPIO net by name.
Returns: GPIO Net instance
input()
Read the digital state of the pin.
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, the LabJack U3 included, uses software polling.
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:
LabJack U3:
FIO0-FIO3are not GPIO pins. On a U3-HV they are fixed high-voltage analog inputs, and the driver refuses them. Read them with an ADC net onAIN0-AIN3.input()reads the pin without a change to its direction.output()sets the pin to output.FIO4-FIO7andEIO0-EIO7are also analog inputs. A GPIO call sets the pin to digital mode.- The EIO and CIO lines are on the DB15 connector of the U3.
Multi-channel FTDI adapters
An FTDI net takes its channel fromparams.interface on the net record, accepting
A-D or 0-3. Set it with lager nets add --interface. 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 1output()accepts integers (0/1) or strings (“high”/“low”, “on”/“off”, “true”/“false”)wait_for_level()takes an integer level (0or1) and 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

