Skip to content
Alexander Hiam edited this page Apr 17, 2015 · 1 revision

The HTU21D library allows you to connect to a HTU21D humidity and temperature sensor over I2C.

Adafruit sells a nice breakout for the HTU21D: https://www.adafruit.com/products/1899

##Examples

##API

####HTU21D(i2c_bus) Creates an instance of the HTU21D class using the given I2C bus (I2C1 or I2C2).
An AssertionError will be thrown if no HTU21D is found on the I2C bus.

#####HTU21D.getPressure() Reads and returns the current relative humidity.
The received value is checked against a CRC and an AssertionError is thrown if it is invalid.

#####HTU21D.getTemp() Returns current temperature in Celsius.
The received value is checked against a CRC and an AssertionError is thrown if it is invalid.

#####HTU21D.getTempF() Returns current temperature in Fahrenheit.
The received value is checked against a CRC and an AssertionError is thrown if it is invalid.

#####HTU21D.calculateDewPoint(rh, temp) Returns current temperature in Fahrenheit.
Calculates and returns the dew point for the given relative humidity and temperature in Celsius.