Read the teperature from the sensor. Show the results on the seriel port using 4 variables, Max_temp, Min_Temp, Avg_Temp and the temperature. Every day of use the values will reset

Dependencies:   LM61 TMP36 mbed

Files at this revision

API Documentation at this revision

Comitter:
mabenim
Date:
Tue Apr 05 23:11:49 2016 +0000
Child:
1:a6142383bb3e
Commit message:
Se a?adi? temperatura m?xima y m?nima

Changed in this revision

LM61.lib Show annotated file Show diff for this revision Revisions of this file
TMP36.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/LM61.lib	Tue Apr 05 23:11:49 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Match314/code/LM61/#7fe5f722fc6b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TMP36.lib	Tue Apr 05 23:11:49 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/zchen311/code/TMP36/#ab3d7d0c34ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 05 23:11:49 2016 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+Serial pc(SERIAL_TX, SERIAL_RX);
+AnalogIn analog_value(A2);
+
+
+int main()
+{
+    float Temperatura;
+    float voltage;
+    float Temperatura_max;
+    float Temperatura_min;
+
+    printf("\Ejemplo temperatura\n");
+    Temperatura_max=-100;
+    Temperatura_min=100;
+    while(1) {
+        voltage=analog_value.read()*3.3;
+        Temperatura=(voltage-0.5)*100;
+        if (Temperatura>Temperatura_max) {
+            Temperatura_max=Temperatura;
+        }
+        if (Temperatura<Temperatura_min) {
+            Temperatura_min=Temperatura;
+        }
+        pc.printf("Voltage %.5f V\n", voltage);
+        pc.printf("Temperatura = %.2f C\n", Temperatura);
+        pc.printf("Temperatura máxima = %.2f C\n", Temperatura_max);
+        pc.printf("Temperatura mínima = %.2f C\n", Temperatura_min);
+        wait(60);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 05 23:11:49 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9
\ No newline at end of file