MicroPython HTU21DF Driver¶
htu21df
¶
MicroPython HTU21D-F Temperature & Humidity driver
Author(s): ktown, Jose D. Montoya
-
class micropython_htu21df.htu21df.HTU21DF(i2c, address: int =
0x40
)[source]¶ Driver for the HTU21DF Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
HTU21DF
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_htu21df import htu21df
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) htu21df = htu21df.HTU21DF(i2c)
Now you have access to the attributes
temp = htu.temperature rh = htu.humidity
- reset() None [source]¶
Perform a soft reset of the sensor, resetting all settings to their power-on defaults