adafruit_hts221¶
Helper library for the HTS221 Humidity and Temperature Sensor
- Author(s): Bryan Siepert
Implementation Notes¶
Hardware:
- Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards:
- https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
-
class
adafruit_hts221.HTS221(i2c_bus)¶ Library for the ST HTS221 Humidity and Temperature Sensor
Parameters: i2c_bus (I2C) – The I2C bus the HTS221 is connected to Quickstart: Importing and using the HTS221
Here is an example of using the
HTS221class. First you will need to import the libraries to use the sensorimport board import adafruit_hts221
Once this is done you can define your
board.I2Cobject and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA hts = adafruit_hts221.HTS221(i2c)
Now you have access to the
temperatureandrelative_humidityattributestemperature = hts.temperature relative_humidity = hts.relative_humidity
-
data_rate¶ The rate at which the sensor measures
relative_humidityandtemperature.data_rateshould be set to one of the values ofadafruit_hts221.Rate. Note that settingdata_ratetoRate.ONE_SHOTwill causerelative_humidityandtemperaturemeasurements to only update whentake_measurements()is called.
-
humidity_data_ready¶ Returns true if a new relative humidity measurement is available to be read
-
relative_humidity¶ The current relative humidity measurement in %rH
-
take_measurements()¶ Update the value of
relative_humidityandtemperatureby taking a single measurement. Only meaningful ifdata_rateis set toONE_SHOT
-
temperature¶ The current temperature measurement in degrees Celsius
-
temperature_data_ready¶ Returns true if a new temperature measurement is available to be read
-