Ramana R
/
MQ9
This is a library for the MQ9 gas sensor module.
MQ9.h@1:9a7fb445a7ad, 2018-05-01 (annotated)
- Committer:
- NXP_Rr
- Date:
- Tue May 01 20:33:25 2018 +0000
- Revision:
- 1:9a7fb445a7ad
- Parent:
- 0:7712450a546d
- Child:
- 2:c366191f8865
Added documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
NXP_Rr | 0:7712450a546d | 1 | #ifndef _____MQ9_____ |
NXP_Rr | 0:7712450a546d | 2 | #define _____MQ9_____ |
NXP_Rr | 0:7712450a546d | 3 | |
NXP_Rr | 0:7712450a546d | 4 | #include "mbed.h" |
NXP_Rr | 0:7712450a546d | 5 | |
NXP_Rr | 0:7712450a546d | 6 | #define MQ9_STATUS_PASS 0 |
NXP_Rr | 0:7712450a546d | 7 | #define MQ9_STATUS_FAIL -1 |
NXP_Rr | 0:7712450a546d | 8 | |
NXP_Rr | 0:7712450a546d | 9 | /** Class for the MQ9 sensor. |
NXP_Rr | 0:7712450a546d | 10 | * This library is a modified version of the MQ2 library for Arduino |
NXP_Rr | 0:7712450a546d | 11 | * Example: |
NXP_Rr | 0:7712450a546d | 12 | * |
NXP_Rr | 0:7712450a546d | 13 | */ |
NXP_Rr | 0:7712450a546d | 14 | class MQ9 |
NXP_Rr | 0:7712450a546d | 15 | { |
NXP_Rr | 0:7712450a546d | 16 | public: |
NXP_Rr | 0:7712450a546d | 17 | /// Construct the sensor object and setup the sensor pins |
NXP_Rr | 0:7712450a546d | 18 | MQ9(PinName const &p); |
NXP_Rr | 0:7712450a546d | 19 | |
NXP_Rr | 0:7712450a546d | 20 | /// Update the gas concentrations from the sensor. |
NXP_Rr | 0:7712450a546d | 21 | int read(); |
NXP_Rr | 0:7712450a546d | 22 | |
NXP_Rr | 0:7712450a546d | 23 | /// Get concentration of LPG |
NXP_Rr | 0:7712450a546d | 24 | float getLPG_ppm(); |
NXP_Rr | 0:7712450a546d | 25 | |
NXP_Rr | 0:7712450a546d | 26 | /// Get concentration of CO |
NXP_Rr | 1:9a7fb445a7ad | 27 | /// Returns the concentration of CO as a floating number |
NXP_Rr | 0:7712450a546d | 28 | float getCO_ppm(); |
NXP_Rr | 0:7712450a546d | 29 | |
NXP_Rr | 0:7712450a546d | 30 | /// Get concentration of Methane |
NXP_Rr | 0:7712450a546d | 31 | float getMethane_ppm(); |
NXP_Rr | 0:7712450a546d | 32 | |
NXP_Rr | 0:7712450a546d | 33 | private: |
NXP_Rr | 0:7712450a546d | 34 | /// Concentration of LPG |
NXP_Rr | 0:7712450a546d | 35 | float _LPG_ppm; |
NXP_Rr | 0:7712450a546d | 36 | /// Concentration of CO |
NXP_Rr | 0:7712450a546d | 37 | float _CO_ppm; |
NXP_Rr | 0:7712450a546d | 38 | /// Concentration of Methane |
NXP_Rr | 0:7712450a546d | 39 | float _Methane_ppm; |
NXP_Rr | 0:7712450a546d | 40 | |
NXP_Rr | 0:7712450a546d | 41 | /// pin to read the sensor information |
NXP_Rr | 0:7712450a546d | 42 | AnalogIn _pin; |
NXP_Rr | 0:7712450a546d | 43 | }; |
NXP_Rr | 0:7712450a546d | 44 | |
NXP_Rr | 0:7712450a546d | 45 | #endif |