Guillaume GARBAY
/
HTU21D-F_Nucleo_F411RE
HTU21D-F with board Nucleo_F411RE
Fork of HTU21D_HELLOWORLD by
Diff: main.cpp
- Revision:
- 0:8c0ef32974f0
- Child:
- 1:cfb1e959c32a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Oct 19 19:29:21 2014 +0000 @@ -0,0 +1,48 @@ +/** Sample program to read temperature and humidity + * + * @author Alex Lipford + * Georgia Institute of Technology + * ECE 4180 Embeded Systems Design + * Professor Hamblen + * 10/19/2014 + * + * @section LICENSE + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <alexlipford@gmail.com> wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. + * ---------------------------------------------------------------------------- + * + * + * @section DESCRIPTION + * + * Honeywell HTU21D Humidity and Temperature sensor. + * + * Datasheet, specs, and information: + * + * https://www.sparkfun.com/products/12064 + */ + +#include "mbed.h" +#include "HTU21D.h" + +HTU21D temphumid(p9, p10); //Temp humid sensor || SDA, SCL +int sample_ftemp; +int sample_ctemp; +int sample_ktemp; +int sample_humid; + +int main() { + while(1) { + sample_ftemp = temphumid.sample_ftemp(); + sample_ctemp = temphumid.sample_ctemp(); + sample_ktemp = temphumid.sample_ktemp(); + sample_humid = temphumid.sample_humid(); + printf("Temperature: %d F\n\r", sample_ftemp); + printf("Temperature: %d C\n\r", sample_ctemp); + printf("Temperature: %d K\n\r", sample_ktemp); + printf("Humidity: %d %%\n\r", sample_humid); + printf("\n\r"); + } +}