hts221 — HTS221 humidity/temperature sensor
Driver for the ST HTS221 capacitive relative humidity and temperature sensor over I2C. The driver reads the factory calibration values from non-volatile memory on construction and uses them to convert the raw register readings into calibrated values.
Example:
import time
from machine import Pin, I2C
from hts221 import HTS221
bus = I2C(1, scl=Pin(15), sda=Pin(14))
hts = HTS221(bus)
while True:
print("rH: %.2f%% T: %.2fC" % (hts.humidity(), hts.temperature()))
time.sleep_ms(100)
Classes
- class hts221.HTS221(bus: machine.I2C, data_rate: int = 1, address: int = 0x5F)
Construct an
HTS221instance.busA configured
machine.I2Cbus the sensor is attached to.data_rateOutput data-rate selector written into the
CTRL_REG1ODR field. Valid values are 0 (one-shot), 1 (1 Hz), 2 (7 Hz) and 3 (12.5 Hz).address7-bit I2C address of the device. Defaults to
0x5F, the factory address used by all HTS221 parts.