a

Dependencies:   LM75B mbed

Files at this revision

API Documentation at this revision

Comitter:
bulmenwt
Date:
Wed Jan 28 07:48:11 2015 +0000
Commit message:
a

Changed in this revision

LM75B.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 620c051199c6 LM75B.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Wed Jan 28 07:48:11 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
diff -r 000000000000 -r 620c051199c6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 28 07:48:11 2015 +0000
@@ -0,0 +1,94 @@
+/*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);
+
+typedef enum { led_on, temp, led_off} state_t ;
+
+state_t state = led_on;
+
+/* function declaration */
+void maxTemp();
+void stateMachine();
+
+
+//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() ;
+     stateMachine();
+     wait(1); 
+               
+    //Print the current temperature
+   // printf("Temp = %.3f\n\r", (float)sensor);
+    //Sleep for 0.5 seconds
+    wait(0.5);
+    }
+    } else {
+     error("Device not detected!\n");
+    }  
+}
+
+
+/* function declaration */
+void maxTemp();
+
+void stateMachine()
+{
+  switch( state ) {
+    case led_on:
+       printf("STATE:  led_on!\n\r");
+       Led2=1;
+       Led3=1;
+       state = temp;
+       break;
+ 
+    case temp:
+      printf("STATE:  temp!\n\r");
+      printf("Temp = %.3f\n\r", (float)sensor);
+      wait(0.5);
+      state = led_off;
+      break;
+ 
+    case led_off:
+       printf("STATE:  led_off!\n\r");
+       Led2=0;
+       Led3=0;
+       state = led_on;
+       break;
+  }
+}
+
+void maxTemp() 
+{
+   /* local variable declaration */
+   
+ 
+   if (sensor > 29.0) {
+      Led1=1; 
+      }
+   else
+      Led1=0; 
+ 
+   //return 0; 
+   
+}
\ No newline at end of file
diff -r 000000000000 -r 620c051199c6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 28 07:48:11 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file