Hello Everyone,
I recently bought a Raspberry Pi 5, and I’m encountering an issue with the RPi.GPIO library not working due to hardware changes. Consequently, I need to use a library compatible with the new hardware, like gpiod or GPIOZERO. I was advised to use GPIOZERO as it is more beginner-friendly and offers features like PWM and built-in pull-up resistors.
However, when I tried to turn on an LED using the GPIOZERO library, I found that my code wasn’t outputting any voltage on the GPIO pin. I tested this with a multimeter and confirmed that no voltage was being output. On the other hand, when I used the gpiod library, it worked perfectly fine.
Does anyone know why I am encountering this issue with GPIOZERO and how I can fix it?
Raspberry Pi 5 gpiozero
The issue you're encountering with the GPIOZERO library on your Raspberry Pi 5 is likely due to the ongoing transition and updates required for full compatibility with the new hardware. The Raspberry Pi 5 introduces several changes to the GPIO system that may cause some libraries to behave unexpectedly, especially if they haven't been fully updated for the new platform.
You provide insufficient detail, but if the GPIOZERO code is the complete program it is probably doing exactly what you told it to do.
The code will run, turn your LED ON, and immediately exit, restoring the pins to the initial state and exiting. The LED will light for less than a microsecond.
Include a sleep at the end or a pause.
Note GPIOZERO uses lgpio as its underlying library. This is reasonably documented and behaves more like the older libraries.
None of the existing libraries support hardware PWM, only software PWM; at least I am unaware of any. libgpiod only supports GPIO functionality it was never intended to support other functions.
You provide insufficient detail, but if the GPIOZERO code is the complete program it is probably doing exactly what you told it to do.
The code will run, turn your LED ON, and immediately exit, restoring the pins to the initial state and exiting. The LED will light for less than a microsecond.
Include a sleep at the end or a pause.
Note GPIOZERO uses lgpio as its underlying library. This is reasonably documented and behaves more like the older libraries.
None of the existing libraries support hardware PWM, only software PWM; at least I am unaware of any. libgpiod only supports GPIO functionality it was never intended to support other functions.