a

Dependencies:   LM75B mbed

Revision:
0:ac20f3855117
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 28 07:47:01 2015 +0000
@@ -0,0 +1,67 @@
+/*M0-BOARD LPC11U24 VERSION 1.0 / HI/ENE/WF 09_2014
+BULME Graz / Elektronik 29
+Alternativ ohne Library für LM75B
+*/
+#include "mbed.h"
+#include "LM75B.h"
+
+DigitalOut  Led1(LED1);
+DigitalOut  Led2(LED2);
+DigitalOut  Led3(LED3);
+DigitalOut  Led4(LED4);
+
+
+
+/* function declaration */
+void maxTemp();
+
+
+
+
+//Create an LM75B object at the default address (ADDRESS_0)
+LM75B sensor(p28, p27);
+int main()
+{
+//Try to open the LM75B
+    if (sensor.open()) {
+        printf("Device detected!\n\r");
+    while (1) {
+        
+        
+     Led4=1;
+     wait(0.2);
+     Led4=0;
+     wait(0.2); 
+     
+     maxTemp() ;
+        
+        
+    //Print the current temperature
+    printf("Temp = %.1f\n\r", (float)sensor);
+    //Sleep for 0.5 seconds
+    wait(0.5);
+    }
+    } else {
+     error("Device not detected!\n");
+    }
+    
+    
+    
+    
+}
+
+
+void maxTemp() 
+{
+   /* local variable declaration */
+   
+ 
+   if (sensor > 29.0) {
+      Led1=1; 
+      }
+   else
+      Led1=0; 
+ 
+   //return 0; 
+   
+}
\ No newline at end of file