A sample program to read the temperature and humidity from the HTU21D sensor.

Dependencies:   HTU21D mbed

Files at this revision

API Documentation at this revision

Comitter:
alipford3
Date:
Sun Oct 19 19:29:21 2014 +0000
Commit message:
A sample program to read the temperature and humidity from the HTU21D sensor.

Changed in this revision

HTU21D.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8c0ef32974f0 HTU21D.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTU21D.lib	Sun Oct 19 19:29:21 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/alipford3/code/HTU21D/#4fd07be6bad8
diff -r 000000000000 -r 8c0ef32974f0 main.cpp
--- /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");
+    }
+}
diff -r 000000000000 -r 8c0ef32974f0 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Oct 19 19:29:21 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file