Checking Gas sensor

Dependencies:   mbed

Fork of Gas_sensor_program by Irayya Mathad

main.cpp

Committer:
irayya
Date:
2017-05-25
Revision:
1:047cac5e159c
Parent:
0:9dfbe7667fba

File content as of revision 1:047cac5e159c:

#include "mbed.h"


DigitalOut buz(D1);
AnalogIn gas (A0);
Serial pc(USBTX,USBRX);


int main()
{
    while(1) {
        float gasout=gas.read();
        pc.printf("anlaog value is %f\n :",gasout);
        if(gasout>0.6) {
            buz=1;
            wait(0.2);

            buz=0;
            wait(0.2);
        } else {

            buz=0;
        }
    }
}