Closed robiwano closed 5 years ago
sounds like maybe you can add some time.sleep delays around, since its running too fast? see where that helps and let us know!
Adding a 100 ms sleep after getting sensor
fixed it:
#!/usr/bin/python3
import time
import board
import busio
from adafruit_htu21d import HTU21D
# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
sensor = HTU21D(i2c)
time.sleep(0.1)
while True:
print("\nTemperature: %0.1f C" % sensor.temperature)
print("Humidity: %0.1f %%" % sensor.relative_humidity)
time.sleep(2)
Actually, even a time.sleep(0.001)
makes it work.
ooh ok, want to submit a PR to fix by adding a delay at the end of the HTU21D init? :)
Done
Fixed by #5. Thanks @dherrada
I've installed all prerequisites, and I get the following when running my script read_sensor.py:
However, entering all the commands in a python3 shell works just fine... (?). Content of read_sensor.py is: