Exemple 1 CRTI

Dependencies:   C12832 LM75B mbed

Fork of app-board-LM75B by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
bouaziz
Date:
Tue Dec 20 14:03:40 2016 +0000
Parent:
5:608f2bf4d3f7
Commit message:
test CRTI

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
--- a/LM75B.lib	Thu Feb 06 14:05:51 2014 +0000
+++ b/LM75B.lib	Tue Dec 20 14:03:40 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/neilt6/code/LM75B/#fc27dc535ea9
+http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
--- a/main.cpp	Thu Feb 06 14:05:51 2014 +0000
+++ b/main.cpp	Tue Dec 20 14:03:40 2016 +0000
@@ -1,28 +1,55 @@
 #include "mbed.h"
+#include "C12832.h"
 #include "LM75B.h"
-#include "C12832.h"
+
 
 C12832 lcd(p5, p7, p6, p8, p11);
 
 LM75B sensor(p28,p27);
 Serial pc(USBTX,USBRX);
+Timer t; 
+AnalogIn simtemp (p19);
+PwmOut r (p23);
+PwmOut g (p24);
+PwmOut b (p25);
+Ticker periode;
 
-int main ()
-{
 
-    //Try to open the LM75B
-    if (sensor.open()) {
-        printf("Device detected!\n");
+volatile float dt;
+volatile char flagtemp;
+///////////////////////////////////////////////
+//   fonction Flip pour gérer le timer 500ms
+
+void flip(){
+    dt=sensor.temp();
+    flagtemp=1;
+}
+
 
-        while (1) {
-            lcd.cls();
-            lcd.locate(0,3);
-            lcd.printf("Temp = %.3f\n", (float)sensor);
-            wait(1.0);
+int main() {
+       r.period(0.005);
+       g.period(0.005);
+       b.period(0.005);
+       g=1.0;
+       b=1.0;
+       lcd.cls();
+       if (sensor.open()) {
+            pc.printf("Device detected!\n");
+        }else {
+            pc.printf("Device not detected!\n");
         }
+        periode.attach(&flip, 0.5);
+      // t.reset();
+       while (1) {
+            //tx.start()
+                         //Print the current temperature
+             if(flagtemp==1) {
+                    pc.printf("Temp = %.3f\r\n", dt);
+                    r = 1- (dt-25)/8.0 ;
+                    flagtemp=0;
+              }
+       } 
+}
 
-    } else {
-        error("Device not detected!\n");
-    }
-
-}
+//            lcd.copy_to_lcd();  // LCD.pixel does not update the lcd
+//            wait_us(3000);
--- a/mbed.bld	Thu Feb 06 14:05:51 2014 +0000
+++ b/mbed.bld	Tue Dec 20 14:03:40 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0
+http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897
\ No newline at end of file