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
main.cpp
- Committer:
- mich_mich74
- Date:
- 2019-05-13
- Revision:
- 5:a7b8bdbd38df
- Parent:
- 4:dc0214c23232
File content as of revision 5:a7b8bdbd38df:
#include "mbed.h"
#include "MiCS6814_GasSensor.h"
Serial pc(USBTX, USBRX);
float co;
float c4h10;
float c3h8;
float ch4;
MiCS6814_GasSensor sensor(I2C_SDA, I2C_SCL);
int main()
{
pc.printf("test start\n");
while(1) {
co = sensor.getGas(CO);
co = co / 10000;
pc.printf("monoxyde de carbonne: %.2f \r\n", co); //affichage en % du taux de monoxyde de carbonne
if(co >= 0.02) pc.printf("danger monoxyde de carbonne \r\n");
c4h10 = sensor.getGas(C4H10);
c4h10 = c4h10 / 10000;
pc.printf("butane: %.2f \r\n", c4h10);//affichage en % du taux de butane
if(c4h10 >= 1.50) pc.printf("danger butane \r\n");
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");
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(3);
}
}