1

Dependencies:   mbed Sht31 C12832

Files at this revision

API Documentation at this revision

Comitter:
s121212456
Date:
Tue Nov 09 13:35:02 2021 +0000
Commit message:
9

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
Sht31.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
diff -r 000000000000 -r 2d9531207d5f C12832.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Tue Nov 09 13:35:02 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/askksa12543/code/C12832/#990d5eec2ef6
diff -r 000000000000 -r 2d9531207d5f Sht31.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sht31.lib	Tue Nov 09 13:35:02 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/GeofferyOmlette/code/Sht31/#756e26f0b067
diff -r 000000000000 -r 2d9531207d5f main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 09 13:35:02 2021 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"
+#include "C12832.h"
+#include "Sht31.h"
+
+C12832 lcd(p5,p7,p6,p8,p11);
+Sht31 sht31(I2C_SDA, I2C_SCL);
+DigitalOut Heater(LED1);
+DigitalOut airconditioner(LED2);
+DigitalOut Humidifier(LED3);
+DigitalOut Dehumidifier(LED4);
+
+
+int main() {
+    
+    printf("Set the temperature above 25 degrees to trigger the warning LED\n");
+    
+    while(1) {
+        lcd.cls();
+
+        float temp = sht31.readTemperature();
+        float humidity = sht31.readHumidity();
+
+        lcd.locate(0,0);
+        lcd.printf("Temperature: %.2f C", temp);
+        lcd.locate(64,0);
+        lcd.printf("Humidity: %.2f %%", humidity);
+        lcd.locate(0,10);
+        lcd.printf("Heater Room UP");
+        lcd.locate(0,10);
+        lcd.printf("Cooling Room Down");
+        lcd.locate(0,20);
+        lcd.printf("Increasing Humidity");
+        lcd.locate(0,20);
+        lcd.printf("Decreasing Humidity");
+        
+        // turn on LED if the temperature is above 25 degrees
+        Heater = temp > 25.0f;
+
+        wait(0.5f);
+        
+        Humidifier = 1; //humidifier will be on,LED3 blink
+        wait(0.8);
+        Humidifier = 0; //humidifier will be off,LED3 close
+        wait(0.8);
+        Dehumidifier = 1;
+        wait(0.8);
+        Dehumidifier = 0;
+        wait(0.8);
+    }
+}
diff -r 000000000000 -r 2d9531207d5f mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 09 13:35:02 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file