adafruit_sht4x
Python library for Sensirion SHT4x temperature and humidity sensors
Author(s): ladyada
Implementation Notes
Hardware:
Adafruit SHT40 Temperature & Humidity Sensor (Product ID: 4885)
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
- class adafruit_sht4x.CV
struct helper
- class adafruit_sht4x.Mode
Options for
power_mode
- class adafruit_sht4x.SHT4x(i2c_bus: I2C, address: int = 68)
A driver for the SHT4x temperature and humidity sensor.
- Parameters:
Quickstart: Importing and using the SHT4x temperature and humidity sensor
Here is an example of using the
SHT4x
. First you will need to import the libraries to use the sensorimport board import adafruit_sht4x
Once this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sht = adafruit_sht4x.SHT4x(i2c)
You can now make some initial settings on the sensor
sht.mode = adafruit_sht4x.Mode.NOHEAT_HIGHPRECISION
Now you have access to the temperature and humidity using the
measurements
. It will return a tuple with thetemperature
andrelative_humidity
measurementstemperature, relative_humidity = sht.measurements
- property measurements: Tuple[float, float]
both
temperature
andrelative_humidity
, read simultaneously
- property relative_humidity: float
The current relative humidity in % rH. This is a value from 0-100%.