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.
MQ135.h@0:59011d343342, 2017-06-16 (annotated)
- Committer:
- ngomez
- Date:
- Fri Jun 16 15:01:55 2017 +0000
- Revision:
- 0:59011d343342
Library created for MQ135 gas sensor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngomez | 0:59011d343342 | 1 | /*************************************************** |
ngomez | 0:59011d343342 | 2 | This is a library for MQ135 gas sensor |
ngomez | 0:59011d343342 | 3 | |
ngomez | 0:59011d343342 | 4 | Written by Nerea Gómez. |
ngomez | 0:59011d343342 | 5 | |
ngomez | 0:59011d343342 | 6 | ****************************************************/ |
ngomez | 0:59011d343342 | 7 | |
ngomez | 0:59011d343342 | 8 | #ifndef MBED_MQ135_H |
ngomez | 0:59011d343342 | 9 | #define MBED_MQ135_H |
ngomez | 0:59011d343342 | 10 | |
ngomez | 0:59011d343342 | 11 | |
ngomez | 0:59011d343342 | 12 | #include "mbed.h" |
ngomez | 0:59011d343342 | 13 | |
ngomez | 0:59011d343342 | 14 | class MQ135 { |
ngomez | 0:59011d343342 | 15 | public: |
ngomez | 0:59011d343342 | 16 | MQ135(PinName pin); |
ngomez | 0:59011d343342 | 17 | void initialize(); |
ngomez | 0:59011d343342 | 18 | float getPPM(); |
ngomez | 0:59011d343342 | 19 | int air_quality(); |
ngomez | 0:59011d343342 | 20 | long getRs(); |
ngomez | 0:59011d343342 | 21 | float getRsRo(); |
ngomez | 0:59011d343342 | 22 | |
ngomez | 0:59011d343342 | 23 | private: |
ngomez | 0:59011d343342 | 24 | AnalogIn _pin; |
ngomez | 0:59011d343342 | 25 | long adc_limit; |
ngomez | 0:59011d343342 | 26 | int mqR; |
ngomez | 0:59011d343342 | 27 | long rO; |
ngomez | 0:59011d343342 | 28 | float a; |
ngomez | 0:59011d343342 | 29 | float b; |
ngomez | 0:59011d343342 | 30 | long rS; |
ngomez | 0:59011d343342 | 31 | float rSrO; |
ngomez | 0:59011d343342 | 32 | }; |
ngomez | 0:59011d343342 | 33 | |
ngomez | 0:59011d343342 | 34 | #endif |
ngomez | 0:59011d343342 | 35 | |
ngomez | 0:59011d343342 | 36 | |
ngomez | 0:59011d343342 | 37 | |
ngomez | 0:59011d343342 | 38 | |
ngomez | 0:59011d343342 | 39 |