Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 3:a46c824a4b0a
- Parent:
- 0:807016d5d9ef
- Child:
- 4:dc0214c23232
--- a/main.cpp Wed May 24 10:17:31 2017 +0000
+++ b/main.cpp Wed Jan 30 14:30:06 2019 +0000
@@ -3,6 +3,12 @@
Serial pc(USBTX, USBRX);
+float co;
+float c4h10;
+float c3h8;
+float ch4;
+
+
#if defined(TARGET_LPC1768)
MiCS6814_GasSensor sensor(p28, p27);
#else
@@ -14,9 +20,56 @@
pc.printf("test start\n");
while(1) {
- pc.printf("NH3: %.2f ppm, CO: %.2f ppm, NO2: %.2f ppm, C3H8: %.2f ppm \r\n", sensor.getGas(NH3), sensor.getGas(CO), sensor.getGas(NO2), sensor.getGas(C3H8));
- pc.printf("C4H10: %.2f ppm, CH4: %.2f ppm, H2: %.2f ppm, C2H5OH: %.2f ppm \r\n", sensor.getGas(C4H10), sensor.getGas(CH4), sensor.getGas(H2), sensor.getGas(C2H5OH));
+
+ pc.printf("monoxyde de carbonne: %.2f \r\n", co); //affichage en % du taux de monoxyde de carbonne
+ co = sensor.getGas(CO);
+ co = co / 10000;
+
+ if(co <= 0.02){}
+
+ else
+ {
+ pc.printf("danger monoxyde de carbonne \r\n");
+ }
+
+
+ pc.printf("butane: %.2f \r\n", c4h10);//affichage en % du taux de butane
+ c4h10 = sensor.getGas(C4H10);
+ c4h10 = c4h10 / 10000;
+
+ if(c4h10 <= 1.50){}
+
+ else
+ {
+ pc.printf("danger butane \r\n");
+ }
+
+ pc.printf("propane: %.2f \r\n", c3h8);//affichage en % du taux de propane
+ c3h8 = sensor.getGas(C3H8);
+ c3h8 = c3h8 / 10000;
+
+ if(c3h8 <= 2.00){}
+
+ else
+ {
+ pc.printf("danger propane \r\n");
+ }
+
+
+ pc.printf("methane: %.2f \r\n", ch4);//affichage en % du taux de methane
+ ch4 = sensor.getGas(CH4);
+ ch4 = ch4 / 10000;
+
+ if(ch4 <= 2.50){}
+
+ else
+ {
+ pc.printf("danger methane \r\n");
+ }
+
+
+
pc.printf("\r\n");
- wait(1);
+ wait(5);
}
}