HTU21D - Temperature and Humidity Sensor
The HTU21D is a highly accurate, digital humidity and temperature sensor with an I2C interface. The breakout board includes built in 4.7k pull up resistors. Under references, you can find links to the sensor’s schematic, data sheet and where to purchase it.
Hello World!
Import programHTU21D_HELLOWORLD
A sample program to read the temperature and humidity from the HTU21D sensor.
Library
Import libraryHTU21D
An updated, basic library to interface with the HTU21D digital temperature and humidity sensor
API
HTU21D(PinName sda, PinName scl)
Constructor function, declares sensor
int sample_ctemp(void)
Samples the temperature, inputs void, outputs an int in Celsius
int sample_ftemp(void)
Samples the temperature, inputs void, outputs an int in Fahrenheit
int sample_ktemp(void)
Samples the temperature, inputs void, outputs an int in Kelvin
int sample_humid(void)
Samples the temperature, inputs void, outputs an int
Reference
Link to the HTU21D schematic: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D%20Breakout.pdf
Link to the HTU21D Data Sheet: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D.pdf
Link to purchase the sensor: https://www.sparkfun.com/products/12064
Please log in to post comments.