fork

Dependencies:   DHT mbed

Dependents:   ECE4180_Lab4_ESP8266_IoT_Outlets

Fork of Seeed_Grove_Temp_Humidity_Example by Seeed

Files at this revision

API Documentation at this revision

Comitter:
deronmai
Date:
Thu Mar 17 21:36:49 2016 +0000
Parent:
1:6bcb143683f3
Commit message:
IoT Working

Changed in this revision

dht11.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
diff -r 6bcb143683f3 -r 4639e0a304e0 dht11.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dht11.cpp	Thu Mar 17 21:36:49 2016 +0000
@@ -0,0 +1,28 @@
+
+#include "mbed.h"
+#include "DHT.h"
+
+DHT sensor(D4, DHT11);
+
+int dht11()
+{
+    int error = 0;
+    float h = 0.0f, c = 0.0f, f = 0.0f, k = 0.0f, dp = 0.0f, dpf = 0.0f;
+
+    while(1) {
+        wait(2.0f);
+        error = sensor.readData();
+        if (0 == error) {
+            c   = sensor.ReadTemperature(CELCIUS);
+            f   = sensor.ReadTemperature(FARENHEIT);
+            k   = sensor.ReadTemperature(KELVIN);
+            h   = sensor.ReadHumidity();
+            dp  = sensor.CalcdewPoint(c, h);
+            dpf = sensor.CalcdewPointFast(c, h);
+            printf("Temperature in Kelvin: %4.2f, Celcius: %4.2f, Farenheit %4.2f\n", k, c, f);
+            printf("Humidity is %4.2f, Dewpoint: %4.2f, Dewpoint fast: %4.2f\n", h, dp, dpf);
+        } else {
+            printf("Error: %d\n", error);
+        }
+    }
+}
diff -r 6bcb143683f3 -r 4639e0a304e0 main.cpp
--- a/main.cpp	Tue Mar 10 21:33:31 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-
-#include "mbed.h"
-#include "DHT.h"
-
-DHT sensor(D4, DHT11);
-
-int main()
-{
-    int error = 0;
-    float h = 0.0f, c = 0.0f, f = 0.0f, k = 0.0f, dp = 0.0f, dpf = 0.0f;
-
-    while(1) {
-        wait(2.0f);
-        error = sensor.readData();
-        if (0 == error) {
-            c   = sensor.ReadTemperature(CELCIUS);
-            f   = sensor.ReadTemperature(FARENHEIT);
-            k   = sensor.ReadTemperature(KELVIN);
-            h   = sensor.ReadHumidity();
-            dp  = sensor.CalcdewPoint(c, h);
-            dpf = sensor.CalcdewPointFast(c, h);
-            printf("Temperature in Kelvin: %4.2f, Celcius: %4.2f, Farenheit %4.2f\n", k, c, f);
-            printf("Humidity is %4.2f, Dewpoint: %4.2f, Dewpoint fast: %4.2f\n", h, dp, dpf);
-        } else {
-            printf("Error: %d\n", error);
-        }
-    }
-}