MQ-7 Gas Sensor demo
Dependencies: mbed
Fork of Lab4_4180 by
main.cpp@2:e128a186b567, 2017-04-11 (annotated)
- Committer:
- gandhi1
- Date:
- Tue Apr 11 14:32:00 2017 +0000
- Revision:
- 2:e128a186b567
- Parent:
- 0:ff650029fdf8
SensoreCO
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bryanbates | 0:ff650029fdf8 | 1 | #include "mbed.h" |
bryanbates | 0:ff650029fdf8 | 2 | #include "MQ7.h" |
bryanbates | 0:ff650029fdf8 | 3 | |
gandhi1 | 2:e128a186b567 | 4 | MQ7 sensor(D14, D15); // D0(non collegare), A0 |
bryanbates | 0:ff650029fdf8 | 5 | |
bryanbates | 0:ff650029fdf8 | 6 | int main() { |
bryanbates | 0:ff650029fdf8 | 7 | |
bryanbates | 0:ff650029fdf8 | 8 | while(1) { |
gandhi1 | 2:e128a186b567 | 9 | if (sensor.getAlarm()) { |
gandhi1 | 2:e128a186b567 | 10 | printf("%\t CO è presente"); |
bryanbates | 0:ff650029fdf8 | 11 | } |
gandhi1 | 2:e128a186b567 | 12 | else { |
gandhi1 | 2:e128a186b567 | 13 | printf("%\t CO NON c'è"); |
bryanbates | 0:ff650029fdf8 | 14 | } |
bryanbates | 0:ff650029fdf8 | 15 | } |
gandhi1 | 2:e128a186b567 | 16 | } |