bjorken?

Dependencies:   lib_dht22 mbed

Files at this revision

API Documentation at this revision

Comitter:
co657_jnp8
Date:
Wed Nov 02 16:30:35 2016 +0000
Commit message:
Initial commit;

Changed in this revision

IOT_A4.cpp Show annotated file Show diff for this revision Revisions of this file
lib_dht22.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IOT_A4.cpp	Wed Nov 02 16:30:35 2016 +0000
@@ -0,0 +1,35 @@
+/*
+ * (C) The University of Kent and Simon Cooksey 2015.
+ */
+ 
+#include "mbed.h"
+ 
+#include "dht22.h"
+ 
+Serial host(USBTX, USBRX);
+DHT22 dht22(PTB18);
+ 
+ 
+int main()
+{
+    host.baud(38400);
+    DHT22_data_t dht22_data;
+    host.printf("\r\n\r\nhello world\r\n");
+    while (true) {
+        dht22.read(&dht22_data);
+        
+        float temperature = dht22_data.temp / 10.0f;
+        float humidity = dht22_data.humidity / 10.0f;
+        
+        int check = (dht22_data.humidity/10) + (dht22_data.humidity%10) + (dht22_data.temp/10) + (dht22_data.temp%10);
+        
+        //host.lock ();
+//        host.printf("Temperature: %2.2f    Humidity: %2.2f%%\r\n", temperature, humidity);//, dht22_data.checksum, 0xff & check);
+        host.printf("Temperature: %d (%2.2f)   Humidity: %d (%2.2f)\r\n", dht22_data.temp, temperature, dht22_data.humidity, humidity);//, dht22_data.checksum, 0xff & check);
+        //host.unlock ();
+        
+//        host.printf("0x%04X\t\t0x%04X\t\t0x%02X\r\n", 0xFFFF & dht22_data.temp, 0xFFFF & dht22_data.humidity, 0xFF & dht22_data.checksum);
+        
+        wait_ms(1000);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib_dht22.lib	Wed Nov 02 16:30:35 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/co657_jnp8/code/lib_dht22/#02cbaab7c6cd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 02 16:30:35 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0
\ No newline at end of file