This program is about using a temperature sensor and displaying the temperature on the LCD screen. Not only that when the temperature drops below 25, but the heater is also turned on and the temperature rising above 25 leads to turning on the fan.

Dependencies:   mbed TextLCD TMP36

Files at this revision

API Documentation at this revision

Comitter:
kamleshkandel
Date:
Sat Oct 30 04:23:46 2021 +0000
Commit message:
Kamlesh's Project on an embedded systems. This program is about digital thermostat.

Changed in this revision

TMP36.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/TMP36.lib	Sat Oct 30 04:23:46 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/zchen311/code/TMP36/#ab3d7d0c34ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sat Oct 30 04:23:46 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 30 04:23:46 2021 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+
+
+
+TextLCD lcd(PA_5, PA_6, PA_7, PB_6, PC_7, PA_9, TextLCD::LCD16x2);
+AnalogIn tmp36(PA_0);
+
+PwmOut motor(PA_8);
+
+
+
+ 
+int main()
+{
+ 
+    while(1) {
+        float voltage=3.3f*tmp36.read();
+        float temperature=100.0f*voltage-50.0f;
+        char buffer[14];
+        
+        sprintf(buffer,"Temp in C=%.2f ",temperature);
+      
+       
+        lcd.locate(0,0);
+        lcd.printf(buffer,0,0);
+        float ain;
+        ain =tmp36.read(); 
+        printf("The temperature:",tmp36.read());
+        if (temperature >=25){
+        motor.write(.5f); // (ain);   
+        }
+        else if (temperature<25) {
+            motor. write(.0f);  //period(0.0f);
+            }
+  
+        
+        
+        
+        wait(1.0);
+        
+        
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Oct 30 04:23:46 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file