Working Temperature

Dependencies:   DHT USBDevice mbed mbed

Files at this revision

API Documentation at this revision

Comitter:
mbotkinl
Date:
Mon Mar 16 18:55:33 2015 +0000
Commit message:
Working (semi) temperature

Changed in this revision

DHT.lib Show annotated file Show diff for this revision Revisions of this file
README.html Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib 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
mbed.lib Show annotated file Show diff for this revision Revisions of this file
test.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DHT.lib	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbotkinl/code/DHT/#42593954052a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.html	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,1 @@
+<meta http-equiv="refresh" content="0; url=http://developer.mbed.org/handbook/ExportToOfflineToolchain#ARCH_GPRS#emblocks"/>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#0ca6eeb54b97
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbotkinl/code/mbed/#2cc6bb4d7fea
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test.cpp	Mon Mar 16 18:55:33 2015 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "DHT.h"
+#include "USBSerial.h"
+//#include "DHT11.h"
+
+DigitalOut myled(LED1);
+//DigitalOut myled2(LED2);
+
+//Virtual serial port over USB
+USBSerial serial;
+
+DHT sensor(P1_14,SEN51035P);
+//DHT sensor(P1_14,SEN11301P);
+//DHT11 sensor(P1_14);
+//DHT sensor(A1,SEN51035P);
+//DHT sensor(D4,SEN51035P);
+//DHT sensor(P1_14,DHT22);
+
+DigitalOut power(P1_3);
+
+int main() {
+    int err;
+    serial.printf("\r\nDHT Test program");
+    serial.printf("\r\n******************\r\n");
+    wait(1); // wait 1 second for device stable status
+    power.write(0);
+
+    while (1) {
+        myled = 1;
+        err = sensor.readData();
+        if (err == 0) {
+            //serial.printf("Temperature is %4.2f C \r\n",sensor.ReadTemperature(CELCIUS));
+            serial.printf("Temperature is %4.2f F \r\n",sensor.ReadTemperature(FARENHEIT));
+            //serial.printf("Temperature is %4.2f K \r\n",sensor.ReadTemperature(KELVIN));
+            serial.printf("Humidity is %4.2f \r\n",sensor.ReadHumidity());
+            //serial.printf("Dew point is %4.2f  \r\n",sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity()));
+            //serial.printf("Dew point (fast) is %4.2f  \r\n",sensor.CalcdewPointFast(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity()));
+        } else
+            serial.printf("\r\nErr %i \n",err);
+        myled = 0;
+        //myled2=1;
+        wait(5);
+    }
+}
\ No newline at end of file