HTU21D - Temperature and Humidity Sensor
This 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 libraryHTU21D_HELLOWORLD
This code uses a uLCD-144-G2 128 by 128 Smart Color LCD to display the humidity and temperature in celcius, kelvin, and fahrenheit.
API
HTU21D(PinName sda, PinName scl)
Constructor function, declares sensor.
int sample_ctemp(void)
Samples the temperature, input void, outputs an int in celcius.
int sample_ftemp(void)
Samples the temperature, input void, outputs an int in fahrenheit.
int sample_ktemp(void)
Samples the temperature, input void, outputs an int in kelvin.
int sample_humid(void)
Samples the humidity, input void, outputs and int.
Library
Import libraryHTU21D
BASIC LIBRARY TO INTERFACE WITH HTU21D TEMPERATURE AND HUMIDITY SENSOR
Reference
Link to HTU21D schematic:
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D%20Breakout.pdf
Link to HTU21D Data Sheet:
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/HTU21D.pdf
Link to purchase the sensor:
1 comment on HTU21D - Temperature and Humidity Sensor:
Please log in to post comments.
If you come to Guadalajara, Jalisco, Mexico, I'll give you a beer, or even better a tequila