targetblank / micropython_ahtx0

MicroPython driver for the AHT10 and AHT20 temperature and humidity sensors.
MIT License
32 stars 8 forks source link

no work with ATH25 ?? #6

Closed bellad17 closed 1 month ago

bellad17 commented 2 months ago

hello , csl and sda pin it's good i try with esp3 c3 mini i try with sensor = ahtx0.AHT10(i2c) or sensor = ahtx0.AHT20(i2c) but error Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead Traceback (most recent call last): File "<stdin>", line 10, in <module> File "ahtx0.py", line 50, in __init__ File "ahtx0.py", line 59, in reset OSError: [Errno 116] ETIMEDOUT

targetblank commented 2 months ago

Try using a SoftI2C object (https://docs.micropython.org/en/latest/library/machine.I2C.html#machine.SoftI2C) instead. For example (not tested):

from machine import Pin, SoftI2C
i2c = SoftI2C(scl=Pin(5), sda=Pin(4))
sensor = ahtx0.AHT10(i2c)