> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lagerdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GPO

> Set GPIO output level

Set the digital output level of GPIO pins, with an optional hold mode that keeps the output asserted until interrupted.

## Syntax

```bash theme={null}
lager gpo [NETNAME] LEVEL [OPTIONS]
```

## Arguments

| Argument | Description |
| - | - |
| `NETNAME` | GPIO net name (optional if default is set). If omitted, lists all available GPIO nets. |
| `LEVEL` | Output level (see below) |

## Level Values

The following values are accepted (case-insensitive):

| Value | Result |
| - | - |
| `high`, `on`, `1` | Set pin high |
| `low`, `off`, `0` | Set pin low |
| `toggle` | Invert current state |

## Options

| Option | Description |
| - | - |
| `--box BOX` | Lager Box name or IP address |
| `--hold` | Accepted for older scripts. It has no effect; see [Hold Mode](#hold-mode) |
| `--json` | Emit a machine-readable JSON object instead of formatted text |

***

## Usage

```bash theme={null}
# Set pin high
lager gpo LED1 high --box my-lager-box

# Set pin low
lager gpo LED1 low

# Toggle pin state
lager gpo LED1 toggle

# Using numeric values
lager gpo LED1 1
lager gpo LED1 0

# List available GPIO nets (omit net name and level)
lager gpo --box my-lager-box
```

### Hold Mode

`--hold` has no effect ([#840](https://github.com/lagerdata/lager/issues/840)). The box keeps the device session open, so the pin keeps its level
after the command exits, with or without `--hold`. The command prints a note and exits.
To release a pin, set it to the other level.

```bash theme={null}
# The level stays until the next command changes it
lager gpo RESET_N low --box my-lager-box
lager gpo RESET_N high --box my-lager-box
```

***

## Supported Hardware

| Device | Pins | Voltage |
| - | - | - |
| LabJack T7 | FIO0-FIO7, EIO0-EIO7, CIO0-CIO3, MIO0-MIO2 | 3.3V logic |
| LabJack U3 | FIO4-FIO7, EIO0-EIO7, CIO0-CIO3 | |
| MCC USB-202 | DIO0-DIO7 | 3.3V/5V TTL |
| Aardvark | SCL, SDA, MISO, SCK, MOSI, SS | 3.3V |
| FT232H, FT2232H | 4-15 (AD4-AD7, AC0-AC7) | 3.3V |
| FT4232H | 0-7 | 3.3V |
| YKUSH3 | 1-3 | |

The pin column lists the exact channel tokens that `lager nets add` accepts. On a
multi-channel FTDI part, the net's interface selects channel A, B, C or D.

### LabJack U3 Pins

* `FIO0`-`FIO3` are not offered as `gpio` channels. On a U3-HV they are fixed high-voltage analog inputs.
* Lager treats every U3 as a U3-HV, so a U3-LV also loses these four digital lines.
* A write sets the pin to digital mode and to output.
* A `gpio` net saved on `FIO0`-`FIO3` before version 0.46.1 still lists, but fails when you use it. Delete that net.

### Aardvark Pin Mapping

The Aardvark I2C/SPI adapter exposes 6 GPIO pins on its 10-pin header. Give the signal name as the channel:

| Pin | Name | Header Pin |
| - | - | - |
| 0 | SCL | 1 |
| 1 | SDA | 3 |
| 2 | MISO | 5 |
| 3 | SCK | 7 |
| 4 | MOSI | 8 |
| 5 | SS | 9 |

### FT232H Pin Mapping

The FT232H and FT2232H offer 12 GPIO channels. `AD0`-`AD3` are not offered as `gpio`
channels:

| Pins | Names | Description |
| - | - | - |
| 4-7 | AD4-AD7 | Port A data pins |
| 8-15 | AC0-AC7 | Port A control pins |

***

## Examples

```bash theme={null}
# Control an LED
lager gpo LED1 on --box my-lager-box
sleep 1
lager gpo LED1 off --box my-lager-box

# Toggle reset line
lager gpo RESET_N low
sleep 0.1
lager gpo RESET_N high

# Blink pattern
for i in {1..5}; do
    lager gpo LED1 toggle
    sleep 0.5
done

# Assert a boot strap, flash, then release it
lager gpo BOOT0 high --box my-lager-box
lager debug flash --hex fw.hex --box my-lager-box
lager gpo BOOT0 low --box my-lager-box
```

***

## Related Commands

* [`lager gpi`](https://docs.lagerdata.com/source/reference/cli/gpi) - Read GPIO input state

***

## Notes

* GPO is for setting output pins only
* Use `lager gpi` to read input pins
* Default net can be set with `lager defaults add --gpio-net`
* Pin must be configured as output in net configuration
* Toggle reads current state and inverts it
* USB-202 channels are `DIO0`-`DIO7`
* `--hold` has no effect; it prints a note and exits
* The command sets the output level and exits immediately; the pin retains its state until the next command


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.