Freedom Example for the Seeed Grove Humidity and Temperature Sensor

Dependencies:   DHT mbed

Simply Import this Program into your mbed compiler
Select Compile to generate the binary file
Open an Hyperterminal window and connect to the mbed Serial Port (COMxx) peripheral using speed 9600bps
Plug the Grove Shield v2 on the top of your FRDM-K64F
Connect on end of the 4-pin Grove cable to the Temperature and Humidity module and the other end to the port D4 of the Grove Adapter.

/media/uploads/GregC/grove-temp-humid2.jpg

Drag n drop the frdm_Grove_Temp-Humidity_Example_K64F.bin into the mbed drive from your file explorer
Wait for download to complete
Press the Reset/SW1 button of your FRDM-K64F board to launch the program

Your hyperterminal window should now display Temperature and Humidity measurements (see picture below)!!

/media/uploads/GregC/grove-temp-humid.jpg

Files at this revision

API Documentation at this revision

Comitter:
GregC
Date:
Thu Dec 31 22:03:48 2015 +0000
Commit message:
frdm Seeed Grove Temp-Humidity Example

Changed in this revision

DHT.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 9d72427a0730 DHT.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT.lib	Thu Dec 31 22:03:48 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/components/code/DHT/#df22ddf10d75
diff -r 000000000000 -r 9d72427a0730 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 31 22:03:48 2015 +0000
@@ -0,0 +1,28 @@
+
+#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);
+        }
+    }
+}
diff -r 000000000000 -r 9d72427a0730 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 31 22:03:48 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file