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

MicroPython • AHTx0 sensor with Pico W

$
0
0
I'm having an issue with a AHT20 temp/humidity sensor and micropython.

Found a similar thread: viewtopic.php?t=343128&sid=cf126e6bec0a ... 2974a1fb19, and I tried using their code, but I get an error:

Code:

MPY: soft rebootTraceback (most recent call last):  File "<stdin>", line 10, in <module>  File "/lib/ahtx0.py", line 50, in __init__  File "/lib/ahtx0.py", line 59, in resetOSError: [Errno 5] EIO
I have the latest ahtx0.py from here : https://github.com/targetblank/micropython_ahtx0 in the lib folder on my pico.


My code:

Code:

import utimefrom machine import Pin, I2Cimport ahtx0i2c = I2C(id=0,scl=Pin(5), sda=Pin(4))sensor = ahtx0.AHT10(i2c)while True:    print("\nTemperature: %0.2f C" % sensor.temperature)    print("Humidity: %0.2f %%" % sensor.relative_humidity)    utime.sleep(1)
Any ideas?

Statistics: Posted by kornface13 — Mon Nov 18, 2024 5:58 pm



Viewing all articles
Browse latest Browse all 4968

Trending Articles