DDEG

Dependencies:   HYT TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
jw17594
Date:
Fri Sep 14 09:14:49 2018 +0000
Commit message:
XXE

Changed in this revision

HYT.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.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/HYT.lib	Fri Sep 14 09:14:49 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/Ksenia/code/HYT/#cb02bfe8cf44
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Fri Sep 14 09:14:49 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 14 09:14:49 2018 +0000
@@ -0,0 +1,64 @@
+#include "mbed.h"
+#include "HYT.h"
+#include "TextLCD.h"
+
+
+TextLCD lcd(p15, p16, p17, p18, p19, p20);
+Serial              pc(USBTX, USBRX);
+Ticker              timeKeeping;
+HYT                 SENSOR (p9, p10); // sda, scl
+// HYT sensor polling cycle
+void dataUpdate(void)
+{
+    SENSOR.MRCommand();
+    wait(3);
+    SENSOR.DFCommand();
+}
+
+void secondsCallback(void) {
+    pc.printf("Humidity level: %.1f\r\n%", SENSOR.humidity);
+    pc.printf("Temperature level: %.1f\r\n%", SENSOR.temperature);
+    pc.printf("-------------------------------\r\n%", SENSOR.temperature);
+    lcd.locate(1,0);
+    lcd.printf("Humidity level: %.1f\r\n%", SENSOR.humidity);
+}
+
+
+char ReadT;
+char ReadH;
+DigitalOut TV(LED1);
+DigitalOut TC1(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+
+int main()
+{
+    timeKeeping.attach(&secondsCallback, 3.0f);
+
+    while(1) {
+
+        dataUpdate();
+        ReadT = SENSOR.temperature;
+        ReadH = SENSOR.humidity;
+                if (ReadT < 25 && ReadH > 60){
+            pc.printf(" Heating mode \r\n%");
+
+                TV = 1;
+                TC1 = 0;
+            }
+            else if (ReadT < 25 && ReadH < 50){
+            pc.printf("Heating & Humidification \r\n%");
+                TV = 1;
+                TC1 =1;
+            }
+            else if (ReadT > 25 && ReadT <32  && ReadH >50){
+            pc.printf(" Keep working \r\n%");
+            }
+            else{
+            pc.printf(" Turn off \r\n%");
+            TV = 0;
+            TC1 = 0;
+            }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 14 09:14:49 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file