Skip to main content

Temperature and humidity sensor

Stemi Shield comes a AHT21 sensor built it. It can be accessed through adafruit_ahtx0.AHTx0 class, through i2c communication protocol.

AHT21

Example

main.py
from adafruit_ahtx0 import AHTx0

aht = AHTx0(i2c)

print(f"{aht.temperature:.2f}|{aht.relative_humidity:.2f}")