This is code to test the ARCH GPRS with Grove TempHum sensor.

Dependencies:   USBDevice idDHTLib mbed

Files at this revision

API Documentation at this revision

Comitter:
Njbuch
Date:
Tue Jan 28 18:47:50 2014 +0000
Commit message:
Test of Arch GPRS with Grove TempHum sensor based on DHT11 with the idDHTLib.

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
idDHTLib.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Tue Jan 28 18:47:50 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/idDHTLib.lib	Tue Jan 28 18:47:50 2014 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/kfigiela/code/idDHTLib/#53913db38502
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 28 18:47:50 2014 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "idDHTLib.h"
+#include "USBSerial.h"
+
+DigitalOut myled(LED1);
+//Virtual serial port over USB
+USBSerial serial;
+
+void dhtWrapper();
+idDHTLib DHTLib(P1_24, dhtWrapper);
+
+void dhtWrapper()
+{
+    DHTLib.dht11Callback(); // change do dht11Callback if needed
+}
+
+void readDht()
+{
+    if(!DHTLib.acquiring())  DHTLib.acquire();
+}
+
+int main()
+{
+    float humidity;
+    float temperature;
+    wait(10);
+    serial.printf("\r\nDHT Test program");
+    serial.printf("\r\n******************\r\n");
+    wait(1); // wait 1 second for device stable status
+    DHTLib.acquireAndWait();
+    while (1) {
+        myled = 1;
+        readDht();
+        humidity = DHTLib.getHumidity();
+        temperature = DHTLib.getCelsius();
+        serial.printf("Status is %i\r\n",DHTLib.getStatus());
+        serial.printf("Temperature is %4.2f C \r\n",temperature);
+        serial.printf("Humidity is %4.2f \r\n",humidity);
+
+        myled = 0;
+        wait(10);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 28 18:47:50 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file