HTU31D¶
htu31d¶
MicroPython library for TE HTU31D temperature and humidity sensors
Author(s): ladyada, Jose D. Montoya
-
class micropython_htu31d.htu31d.HTU31D(i2c, address: int =
0x40)[source]¶ Driver for the HTU31D Sensor connected over I2C.
- Parameters:¶
Quickstart: Importing and using the device
Here is an example of using the
HTU31Dclass. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_htu31d import htu31dOnce this is done you can define your
machine.I2Cobject and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) htu31d = htu31d.HTU31D(i2c)Now you have access to the
temperatureandrelative_humidityattributestemperature = htu.temperature relative_humidity = htu.relative_humidity- property humidity_resolution : '0.020%' | '0.014%' | '0.010%' | '0.007%'¶
The current relative humidity resolution in % rH.
Possibles values:
“0.020%”
“0.014%”
“0.010%”
“0.007%”
- property measurements : tuple[float, float]¶
both
temperatureandrelative_humidity, read simultaneously
- reset() None[source]¶
Perform a soft reset of the sensor, resetting all settings to their power-on defaults
- property temp_resolution : '0.040' | '0.025' | '0.016' | '0.012'¶
The current temperature resolution in Celsius.
Possibles values:
“0.040”
“0.025”
“0.016”
“0.012”