HI_temp_LM75B

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Enenkel
Date:
Tue Jun 02 07:50:10 2015 +0000
Commit message:
HI_Temp_LM75B

Changed in this revision

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/main.cpp	Tue Jun 02 07:50:10 2015 +0000
@@ -0,0 +1,58 @@
+/***********************************
+name:   BERTL_2014_TEST
+author: Gottfried Enenkel   HTL BULME
+email:  ene@bulme.at
+description:
+    meßt die Temeratur und zegt sie am PC an     
+    
+***********************************/
+#include "mbed.h"
+#include "LM75B.h"
+// **************** KONSTANTE ****************
+//Create an LM75B object at the default address (ADDRESS_0)
+LM75B sensor(p28, p27);    //i²C Sensor Leitungen
+
+DigitalOut pumpe(LED1);
+DigitalOut Vauf(LED2);     //Heizungsventil AUF
+DigitalOut Vzu(LED3);      //Heizungsventil ZU 
+float(Tsoll);              //Soll Temperatur 
+float(Tist);
+float(Tmp);                // Rechenwert
+
+// ****************** HAUPTPROGRAMM *****************
+int main()
+{
+Vzu=1;          // Vorlaufventil zu machen bis es wirklich zu ist!
+wait (90);      // 90 sec lang auf !
+Vzu = 0;
+    
+Tsoll=30;    
+
+//Try to open the LM75B
+    if (sensor.open()) {
+        printf("Device detected!\n\r");
+        while (1) {
+           //Print the current temperature
+           printf("Temp = %.3f", (float)sensor);
+           printf("    Soll Temperatur = %.1f\n\r", (float)Tsoll);
+           //Sleep for 0.5 seconds
+           wait(0.5);
+           
+           //zu KALT
+           if ((float)sensor < Tsoll-0.2 ) {
+               Vauf = 1;
+               Vzu = 0;
+               }
+           //zu WARM    
+           if ((float)sensor > Tsoll+0.1 ){
+               Vzu = 1;
+               Vauf = 0;
+               }              
+          }
+   
+    } 
+    else {
+          error("Device not detected!\n");
+    }
+}
+// *******************  ENDE ************************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 02 07:50:10 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file