tripping into this too as I just got my Pi5 last week and went full bore into it with code I had working on the pi4. full stop.
I'm seeing some references to using gpiozero instead of rpi.gpio... I'm also seeing some references to using lgpio instead, and more importantly references to using pypi's GPIOD package.
I'm to believe the latter is the best option? https://pypi.org/project/gpiod/ but even it's own examples don't work. For example, the 'gpiodetect.py' file fails because it's calling 'ChipIter(()' which doesn't exist.
/usr/share/doc/python3-libgpiod/examples/gpiodetect.pywhich results in
"AttributeError: module 'gpiod' has no module 'ChipIter'
at this point, it's super unclear which of the three options are to be used in place of the old rpi.gpio.
LGPIO? gpiozero? or GPIOD?
GPIOD seems broken
I'm seeing some references to using gpiozero instead of rpi.gpio... I'm also seeing some references to using lgpio instead, and more importantly references to using pypi's GPIOD package.
I'm to believe the latter is the best option? https://pypi.org/project/gpiod/ but even it's own examples don't work. For example, the 'gpiodetect.py' file fails because it's calling 'ChipIter(()' which doesn't exist.
/usr/share/doc/python3-libgpiod/examples/gpiodetect.py
Code:
if __name__ == '__main__': for chip in gpiod.ChipIter(): print('{} - {} lines:'.format(chip.name(), chip.num_lines())) for line in gpiod.LineIter(chip): offset = line.offset() name = line.name() consumer = line.consumer() direction = line.direction() active_state = line.active_state() print('\tline {:>3}: {:>18} {:>12} {:>8} {:>10}'.format( offset, 'unnamed' if name is None else name, 'unused' if consumer is None else consumer, 'input' if direction == gpiod.Line.DIRECTION_INPUT else 'output', 'active-low' if active_state == gpiod.Line.ACTIVE_LOW else 'active-high')) chip.close()
"AttributeError: module 'gpiod' has no module 'ChipIter'
at this point, it's super unclear which of the three options are to be used in place of the old rpi.gpio.
LGPIO? gpiozero? or GPIOD?
GPIOD seems broken
Statistics: Posted by Corvidael — Thu Jan 25, 2024 4:30 pm