Example program for using my DHT22 library

Dependencies:   lib_dht22 mbed

Files at this revision

API Documentation at this revision

Comitter:
co657_sjc80
Date:
Mon Jan 04 14:46:37 2016 +0000
Commit message:
Initial commit;

Changed in this revision

lib_dht22.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 c0bc947cdcea lib_dht22.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib_dht22.lib	Mon Jan 04 14:46:37 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/co657_sjc80/code/lib_dht22/#257ba13e416e
diff -r 000000000000 -r c0bc947cdcea main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 04 14:46:37 2016 +0000
@@ -0,0 +1,25 @@
+/*
+ * (C) The University of Kent and Simon Cooksey 2015.
+ */
+
+#include "mbed.h"
+
+#include "dht22.h"
+
+Serial host(USBTX, USBRX);
+DHT22 dht22(PTB18);
+
+
+int main()
+{
+    DHT22_data_t dht22_data;
+    while (true) {
+        dht22.read(&dht22_data);
+        
+        float temperature = dht22_data.temp / 10.0f;
+        float humidity = dht22_data.humidity / 10.0f;
+        
+        host.printf("Temperature: %2.2f    Humidity: %2.2f%%\r\n", temperature, humidity);
+        wait_ms(500);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r c0bc947cdcea mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 04 14:46:37 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file