This is code to test the ARCH GPRS with Grove TempHum sensor.
Dependencies: USBDevice idDHTLib mbed
Revision 0:7d6ba98d8088, committed 2014-01-28
- 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
diff -r 000000000000 -r 7d6ba98d8088 USBDevice.lib --- /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
diff -r 000000000000 -r 7d6ba98d8088 idDHTLib.lib --- /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
diff -r 000000000000 -r 7d6ba98d8088 main.cpp --- /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
diff -r 000000000000 -r 7d6ba98d8088 mbed.bld --- /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