LinuxCommandLibrary

raspi-gpio

Query and set Raspberry Pi GPIO pin states

TLDR

Show all GPIO states

$ raspi-gpio get
copy
Get specific pin
$ raspi-gpio get [17]
copy
Set pin as output
$ raspi-gpio set [17] op
copy
Set pin high
$ raspi-gpio set [17] dh
copy
Set pin low
$ raspi-gpio set [17] dl
copy

SYNOPSIS

raspi-gpio command [options]

DESCRIPTION

raspi-gpio is a tool for directly manipulating GPIO pins on Raspberry Pi. It provides low-level access to GPIO configuration without libraries.

PARAMETERS

get [pin]

Get pin state.
set pin options
Set pin configuration.
funcs [pin]
Show available functions.
raw
Show raw register values.

EXAMPLES

$ # Show all pins
raspi-gpio get

# Get pin 17 state
raspi-gpio get 17

# Set pin 17 as output, drive high
raspi-gpio set 17 op dh

# Set pin 18 as input with pull-up
raspi-gpio set 18 ip pu

# Show available functions
raspi-gpio funcs

# Blink LED
raspi-gpio set 17 op dh
sleep 1
raspi-gpio set 17 dl
copy

OPTIONS FOR SET

ip / op

Input / Output mode.
dl / dh
Drive low / high.
pu / pd / pn
Pull up / down / none.

CAVEATS

Raspberry Pi specific. Requires appropriate permissions. Be careful with pin configurations to avoid damage.

HISTORY

raspi-gpio is a utility included with Raspberry Pi OS for direct GPIO access, complementing the GPIO libraries.

SEE ALSO

gpio(1), pinctrl(1), gpioset(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community