Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DHT11-HelloWorld by
Revision 0:3b6dd029d50c, committed 2015-06-23
- Comitter:
- kaizen
- Date:
- Tue Jun 23 00:18:57 2015 +0000
- Child:
- 1:aedc2645d841
- Commit message:
- Example for DHT11 on WIZwiki-W7500
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT.lib Tue Jun 23 00:18:57 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/components/code/DHT/#df22ddf10d75
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jun 23 00:18:57 2015 +0000
@@ -0,0 +1,27 @@
+#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);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 23 00:18:57 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7 \ No newline at end of file
