u/CommonBitchCheddar

Pins not releasing properly with lgpio

I have been trying to put together a simple python script with a Raspberry Pi 5 (model B Rev 1.1 with Pi OS 13 - Trixie).

It is very straightforward:

import lgpio, time

h = lgpio.gpiochip_open(0)

lgpio.gpio_claim_output(h, 22)
lgpio.gpio_write(h, 22, 1)
time.sleep(1)
lgpio.gpio_write(h, 22, 0)
lgpio.gpio_free(h, 22)
lgpio.gpiochip_close(h)

However, when I check using pinctrl in the terminal afterward, the pin is still enabled as an output (and if I don't set it back to low in the script, it stays at high). Is there some other step I am missing on how to control the pins and release them properly so that they go back to inactive?

reddit.com
u/CommonBitchCheddar — 6 days ago