Import
There are two ways to use GPIO:Methods
| Method | Description |
|---|---|
input() | Read digital pin state |
output() | Set digital pin state |
Method Reference
Net.get(name, type=NetType.GPIO)
Get a GPIO net by name.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the GPIO net |
type | NetType | Must be NetType.GPIO |
input()
Read the digital state of the pin.
int - 0 for LOW, 1 for HIGH
output(level)
Set the digital state of the pin.
| Parameter | Type | Description |
|---|---|---|
level | int or str | 0/1, “low”/“high”, “off”/“on” |
Examples
Read Button State
Control LED
Button-Controlled LED
Toggle Output
Hardware Integration
| Hardware | Pin Mapping |
|---|---|
| LabJack T7 | FIO0-FIO7, EIO0-EIO7, CIO0-CIO3 |
Pin Mapping
| Pin Number | LabJack Channel |
|---|---|
| 0 | FIO0 |
| 1 | FIO1 |
| 2 | FIO2 |
| … | … |
| 7 | FIO7 |
Module-Level Functions
For simple scripts, you can use module-level functions instead of the Net API:read(net_name) / gpi(net_name)
Read the current state of a GPIO input pin.
| Parameter | Type | Description |
|---|---|---|
net_name | str | Name of the GPIO net to read |
int - 0 for LOW, 1 for HIGH
write(net_name, level) / gpo(net_name, level)
Set the output state of a GPIO pin.
| Parameter | Type | Description |
|---|---|---|
net_name | str | Name of the GPIO net to set |
level | int or str | 0/1, “low”/“high”, “off”/“on” |
Module Functions vs Net API
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”)
- Each operation opens and closes the LabJack connection
- Net names must match those configured on the Lager Box
gpiandgpoare aliases forreadandwrite(matching CLI command names)

