That is using the gpiod v1.x API. If you do "pip install gpiod" you will get the latest v2.2.0 which is the API neilgl's example is using.Code:
ledline.request(consumer="MYDEVICE", type=gpiod.LINE_REQ_DIR_OUT)
Not that it should matter - either version should work, but you should switch to the latest if you can.
And the consumer here is typically the name of your app.
The persistence behaviour is actually dependent on the kernel, specifically the GPIO driver in the kernel, not the libgpiod/gpiod version. And the OP is using a Pi5 so he has a recent kernel that will persist output values when the process exits.What is the default behaviour of the gpiod library you are using in respect of what happens when the script terminates? (I genuinely don't know, I haven’t investigated that library yet.)
The set_value() is unnecessary as the line value is set to active as part of the request.Code:
config={ LINE: gpiod.LineSettings( direction=Direction.OUTPUT, output_value=Value.ACTIVE ) }, ) as request: request.set_value(LINE, Value.ACTIVE)
Back to the actual issue...
Rather than use a LED directly, have you tested the pin voltage with the LED disconnected? And, to take your code out of the equation, have you tried setting the pin with gpioset? Btw, if you don't have a multimeter, you can connect your output pin to another pin and then read the value of that pin using gpioget.
Oh, and do you have a resistor in the circuit to limit the current the LED can draw? Otherwise you could overload the Pi pin.
Statistics: Posted by warthog618 — Wed Jul 17, 2024 1:25 pm