Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4547

Automation, sensing and robotics • gpiozero eats CPU

$
0
0
Bit of a lament. I'm working on a simple project that needs a button and an LED. I want it to run on any Pi, so ideally I should be using gpiozero (or gpiod). I don't actually have a Pi 5, so I could use RPi.GPIO, and in fact that's what I have ended up with.

Basically, when I declare a button object using gpiozero Python immediately starts eating over 20% of the CPU. This is on a Pi 1, so I really don't have much to spare. This is mentioned here, but I don't know if it will be fixed: https://github.com/gpiozero/gpiozero/issues/1007

If I want to use gpiod I should use version 2, but the standard package in bookworm is 1.6.3, and I don't want to mess around compiling stuff.

So, back to RPi.GPIO, where I can poll the button and eat less than 10% CPU. Which still seems like a lot, but it's half of 20%.

Statistics: Posted by ame — Mon Feb 24, 2025 3:25 am — Replies 0 — Views 33



Viewing all articles
Browse latest Browse all 4547

Trending Articles