Irayya Mathad
/
Gas_sensor_programme
Checking Gas sensor
Fork of Gas_sensor_program by
main.cpp@1:047cac5e159c, 2017-05-25 (annotated)
- Committer:
- irayya
- Date:
- Thu May 25 05:36:12 2017 +0000
- Revision:
- 1:047cac5e159c
- Parent:
- 0:9dfbe7667fba
Checking gas sensor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
irayya | 0:9dfbe7667fba | 1 | #include "mbed.h" |
irayya | 0:9dfbe7667fba | 2 | |
irayya | 1:047cac5e159c | 3 | |
irayya | 0:9dfbe7667fba | 4 | DigitalOut buz(D1); |
irayya | 0:9dfbe7667fba | 5 | AnalogIn gas (A0); |
irayya | 0:9dfbe7667fba | 6 | Serial pc(USBTX,USBRX); |
irayya | 0:9dfbe7667fba | 7 | |
irayya | 0:9dfbe7667fba | 8 | |
irayya | 0:9dfbe7667fba | 9 | int main() |
irayya | 0:9dfbe7667fba | 10 | { |
irayya | 0:9dfbe7667fba | 11 | while(1) { |
irayya | 0:9dfbe7667fba | 12 | float gasout=gas.read(); |
irayya | 0:9dfbe7667fba | 13 | pc.printf("anlaog value is %f\n :",gasout); |
irayya | 0:9dfbe7667fba | 14 | if(gasout>0.6) { |
irayya | 0:9dfbe7667fba | 15 | buz=1; |
irayya | 0:9dfbe7667fba | 16 | wait(0.2); |
irayya | 0:9dfbe7667fba | 17 | |
irayya | 0:9dfbe7667fba | 18 | buz=0; |
irayya | 0:9dfbe7667fba | 19 | wait(0.2); |
irayya | 0:9dfbe7667fba | 20 | } else { |
irayya | 0:9dfbe7667fba | 21 | |
irayya | 0:9dfbe7667fba | 22 | buz=0; |
irayya | 0:9dfbe7667fba | 23 | } |
irayya | 0:9dfbe7667fba | 24 | } |
irayya | 0:9dfbe7667fba | 25 | } |