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-01-30
- Revision:
- 3:a46c824a4b0a
- Parent:
- 0:807016d5d9ef
- Child:
- 4:dc0214c23232
File content as of revision 3:a46c824a4b0a:
#include "mbed.h"
#include "MiCS6814_GasSensor.h"
Serial pc(USBTX, USBRX);
float co;
float c4h10;
float c3h8;
float ch4;
#if defined(TARGET_LPC1768)
MiCS6814_GasSensor sensor(p28, p27);
#else
MiCS6814_GasSensor sensor(I2C_SDA, I2C_SCL);
#endif
int main()
{
pc.printf("test start\n");
while(1) {
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(5);
}
}