TP

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jomfec
Date:
Mon May 02 09:07:15 2016 +0000
Commit message:
INFO2

Changed in this revision

mbed.bld Show annotated file Show diff for this revision Revisions of this file
partie1.cpp Show annotated file Show diff for this revision Revisions of this file
partie2.cpp Show annotated file Show diff for this revision Revisions of this file
partie3.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 02 09:07:15 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/partie1.cpp	Mon May 02 09:07:15 2016 +0000
@@ -0,0 +1,26 @@
+/*#include "mbed.h"
+AnalogIn NTC(p18);
+DigitalIn bouton(p5);
+DigitalOut led(p6);
+
+int main(){
+    while(1){
+        bouton.mode(PullDown);
+        int etat;
+        float tension=NTC.read();
+        float temperature;
+        temperature=29.85*tension*3.3-19.7;
+        etat=bouton.read();
+        if(etat==1)
+            printf("Bouton= %d  U (bornes du resistance) = %g\n",etat,tension);
+            
+            else 
+            printf("Bouton= %d  Temperature = %g\n",etat,temperature);
+            
+        if(temperature>24)
+                led.write(1);
+            else led.write(0);
+        wait(0.25);
+        }
+        }
+   */     
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/partie2.cpp	Mon May 02 09:07:15 2016 +0000
@@ -0,0 +1,29 @@
+/*#include "mbed.h"
+AnalogIn LM335(p18);
+AnalogIn NTC(p19);
+DigitalIn bouton(p5);
+DigitalOut led(p6);
+
+int main(){
+    while(1){
+        bouton.mode(PullDown);
+        int etat;
+        float tension=LM335.read();
+        float tension2=NTC.read();
+        float temperature,temperature2;
+        temperature=((tension*3.3*1)/0.01)-273;
+        temperature2=29.85*tension2*3.3-19.7;
+        etat=bouton.read();
+        if(etat==1)
+            printf("Bouton= %d  U (bornes du resistance) = %g\n",etat,tension);
+            
+            else 
+            printf("Bouton= %d  TemperatureLM335 = %g  TemperatureNTC=%g\n",etat,temperature,temperature2);
+            
+        if(temperature>24)
+                led.write(1);
+            else led.write(0);
+        wait(0.25);
+        }
+        }
+*/ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/partie3.cpp	Mon May 02 09:07:15 2016 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+AnalogIn NTC(p19);
+DigitalIn bouton(p5);
+DigitalIn bouton2(p6);
+DigitalOut led(LED1);
+int etat=0;
+
+int main(){
+    while(1){
+        bouton.mode(PullDown);
+        bouton2.mode(PullDown);
+        int bp1,bp2;
+        float tension=NTC.read();
+        float temperature;
+        temperature=29.85*tension*3.3-19.7;
+        bp1=bouton.read();
+        bp2=bouton2.read();
+        int valeur=17;
+
+        switch(etat){ 
+            case 0: if(bp1==1) etat=1; break;
+            case 1: if(bp1==0) etat=2; break;
+            case 2: if(bp2==1) etat=3; break;
+            case 3: if(bp2==0) etat=4; break;
+            case 4: if(bp2==1) etat=5; 
+                    if(bp1==0) etat=7; break;
+            case 5: if(bp2==0) etat=6; break;
+            case 6: if(bp1==0) etat=4; break;
+            case 7: if(bp1==0) etat=8; break;
+            case 8: if(bp1==1 && bp2==1) etat=0 ; break;
+            
+                    }
+            
+        switch(etat){
+            case 0: printf("Bienvenue\n bp1=%d bp2=%d etat=%d\n",bp1,bp2,etat); break;
+            case 1: printf("Bienvenue\n bp1=%d bp2=%d etat=%d\n",bp1,bp2,etat); break;
+            case 2: printf("Choisir Temperature etat=%d \n",etat); break;
+            case 3: printf("Choisir Temperature etat=%d \n",etat); break;
+            case 4: printf("Temperature : %d\n",valeur); break;
+            case 5: printf("Temperature : %d\n",valeur); 
+                    valeur++; break;
+            case 6: printf("Temperature : %d\n",valeur);
+            case 7: printf("Temperature choisi : %d\n",valeur) ; break;
+            case 8: printf("Temperature choisi : %d\n",valeur) ; break; 
+                    }
+           
+        wait(0.25);
+        }
+        }
\ No newline at end of file