Projet Cubya 2 / Mbed 2 deprecated MiCS6814_GasSensor_Hello

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mich_mich74
Date:
Mon May 13 12:10:19 2019 +0000
Parent:
4:dc0214c23232
Commit message:
;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Feb 13 14:20:33 2019 +0000
+++ b/main.cpp	Mon May 13 12:10:19 2019 +0000
@@ -8,12 +8,8 @@
 float c3h8;
 float ch4;
 
+MiCS6814_GasSensor sensor(I2C_SDA, I2C_SCL);
 
-#if defined(TARGET_LPC1768)
-MiCS6814_GasSensor sensor(p28, p27);
-#else
-MiCS6814_GasSensor sensor(I2C_SDA, I2C_SCL);
-#endif
 
 int main()
 {
@@ -28,7 +24,7 @@
        
     
     
-        pc.printf("butane: %.2f \r\n", c4h10);//affichage en % du taux de butane
+       
          c4h10 = sensor.getGas(C4H10);
           c4h10 = c4h10 / 10000;
             pc.printf("butane: %.2f \r\n", c4h10);//affichage en % du taux de butane
@@ -36,23 +32,23 @@
        
     
         
-        pc.printf("propane: %.2f \r\n", c3h8);//affichage en % du taux de propane
+     
          c3h8 = sensor.getGas(C3H8);
           c3h8 = c3h8 / 10000;
-        
+           pc.printf("propane: %.2f \r\n", c3h8);//affichage en % du taux de propane
             if(c3h8 >= 2.00) pc.printf("danger butane \r\n");
        
        
  
-        pc.printf("methane: %.2f \r\n", ch4);//affichage en % du taux de methane
+       
          ch4 = sensor.getGas(CH4);
           ch4 = ch4 / 10000;
-        
+            pc.printf("methane: %.2f \r\n", ch4);//affichage en % du taux de metane
             if(ch4 >= 2.50) pc.printf("danger methane \r\n");
        
         
         
         pc.printf("\r\n");
-        wait(5);
+        wait(3);
     }
 }