Open JavanXD opened 2 years ago
I have a similar issue with adafruit-circuitpython-hcsr04
on a raspberry pi zero w. It works as the normal pi user, but not with sudo or as root user.
I installed:
pip3 install adafruit-circuitpython-hcsr04
and my simple script looks like this:
#!/usr/bin/python3
import time
import board
import adafruit_hcsr04
sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.D5, echo_pin=board.D6)
while True:
try:
print("Distance: %.2f cm" % sonar.distance)
except RuntimeError:
print("Retrying!")
time.sleep(1)
I got the same error when I start the script as root user:
RuntimeError: Timed out waiting for PulseIn message. Make sure libgpiod is installed.
@alaub81 I created this support request in the Adafruit forum: https://forums.adafruit.com/viewtopic.php?f=24&t=183236&p=890751#p890221 I would recommend to you to save yourself some time and use another library.
I am using a clean Raspberry Pi OS install (version: 2021-03-04-raspbian-buster) on a Raspberry Zero WH. You can download the image or you can check the used install instructions here.
I installed the following two packages:
sudo pip3 install adafruit-circuitpython-dht && sudo apt-get install libgpiod2
PoC:
(full script)
Console:
Notes: yes, root user is part of gpio group (
sudo usermod -aG gpio root
)I noticed that I am not the only one affected by this issue:
I have been using the Adafruit_DHT library for a long time but because you stopped fixing issues such as this I've migrated to your new library. Unfortunately it turns out that you do not fix issues for Raspi Zero. What I am supposed to use now? Please fix this issue.