gpiozero 与 rpi.gpio 库性能 + 控制
gpiozero vs rpi.gpio library Performance + Control
我担心在旧 rpi.gpio 库上使用 gpiozero 的优缺点,是否有任何性能差异或较低级别的控制差异?
我看了这个论坛,但它并没有真正回答我的问题
https://www.raspberrypi.org/forums/viewtopic.php?t=204466
我从那个论坛得到的是它是标准 rpi 库的包装器,通常根据我的编程经验,包装器往往速度较慢并且提供的灵活性较低以换取易用性
但是,由于论坛中没有具体说明,而且我不知道性能差异是否很小,所以很难知道我应该使用哪一个
为什么 GPIO Zero 的方法更好?
尽可能简短易读。 gpiozero 模块始终使用 Broadcom GPIO 编号来标识 GPIO,因此无需设置。对此有一点解释:
BOARD numbering might seem simpler but I'd say it leads new users to think all the pins are general purpose---and they're not. Connect an LED to pin 11, why not connect some more to pins 1, 2, 3 and 4? Well 1 is 3V3. 2 and 4 are 5V. A lack of awareness of what the purpose of the pins is can be dangerous.
GPIO 零实际上更好吗?
On the one hand, removing the setup code is excellent for beginners and seasoned coders alike. Writing code is more straightforward and quicker. On the other hand, knowing exactly what is going on is important for learning.
我在 this article 中找到了这个描述。所以我想如果你知道你在做什么或者如果你想看看它是如何工作的我会使用 gpiozero。但如果你想自己设置所有引脚,我会使用 rpi.gpio.
我担心在旧 rpi.gpio 库上使用 gpiozero 的优缺点,是否有任何性能差异或较低级别的控制差异?
我看了这个论坛,但它并没有真正回答我的问题 https://www.raspberrypi.org/forums/viewtopic.php?t=204466
我从那个论坛得到的是它是标准 rpi 库的包装器,通常根据我的编程经验,包装器往往速度较慢并且提供的灵活性较低以换取易用性
但是,由于论坛中没有具体说明,而且我不知道性能差异是否很小,所以很难知道我应该使用哪一个
为什么 GPIO Zero 的方法更好?
尽可能简短易读。 gpiozero 模块始终使用 Broadcom GPIO 编号来标识 GPIO,因此无需设置。对此有一点解释:
BOARD numbering might seem simpler but I'd say it leads new users to think all the pins are general purpose---and they're not. Connect an LED to pin 11, why not connect some more to pins 1, 2, 3 and 4? Well 1 is 3V3. 2 and 4 are 5V. A lack of awareness of what the purpose of the pins is can be dangerous.
GPIO 零实际上更好吗?
On the one hand, removing the setup code is excellent for beginners and seasoned coders alike. Writing code is more straightforward and quicker. On the other hand, knowing exactly what is going on is important for learning.
我在 this article 中找到了这个描述。所以我想如果你知道你在做什么或者如果你想看看它是如何工作的我会使用 gpiozero。但如果你想自己设置所有引脚,我会使用 rpi.gpio.