Simon Cooksey / Mbed 2 deprecated frdm_dht22_example

Dependencies:   lib_dht22 mbed

Revision:
0:c0bc947cdcea
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