MicroPython HDC1080 Driver¶
hdc1080
¶
MicroPython driver for the TI HDC1080 Temperature and Humidity sensor
Author: Jose D. Montoya
-
class micropython_hdc1080.hdc1080.HDC1080(i2c, address: int =
0x40
)[source]¶ Driver for the HDC1080 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
HDC1080
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_hdc1080 import hdc1080
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) hdc1080 = hdc1080.HDC1080(i2c)
Now you have access to the attributes
temp = hdc1080.temperature
- property humidity_resolution : str¶
Sensor humidity_resolution
Mode
Value
hdc1080.HUM_RES_14BIT
0b00
hdc1080.HUM_RES_11BIT
0b01
hdc1080.HUM_RES_8BIT
0b10
- property measurements : tuple[float, float]¶
Return Temperature in Celsius and Relative humidity in rh%