This is a library to read out sensor values from Silicon Labs' si70xx-range of relative humidity and temperature sensors.
Dependents: MemLCD-Temperature-Humidity-Demo lab123
You are viewing an older revision! See the latest version
Homepage
Usage¶
Include mbed low-power to use this driver
#include "mbed.h" #include "SILABS_RHT.h" I2C sensorI2C(PD6, PD7); //PD6=SDA, PD7=SCL silabs::SILABS_RHT rhtSensor(&sensorI2C); volatile bool busChecked = false; void respondedCallback( void ) { busChecked = true; } int main() { rhtSensor.check_availability(si7021, respondedCallback); while(busChecked == false) sleep(); busChecked = false; rhtSensor.measure(si7021, respondedCallback); while(busChecked == false) sleep(); if(rhtSensor.get_active()) { printf("Temperature: %d.%03d degC\n", rhtSensor.get_Temperature()/1000, rhtSensor.get_Temperature()%1000); } else { printf("No sensor found\n"); } while(1) sleep(); }
Datasheets¶
http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx