Ramana R
/
MQ9
This is a library for the MQ9 gas sensor module.
MQ9.h@2:c366191f8865, 2018-05-01 (annotated)
- Committer:
- NXP_Rr
- Date:
- Tue May 01 20:36:47 2018 +0000
- Revision:
- 2:c366191f8865
- Parent:
- 1:9a7fb445a7ad
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 | 2:c366191f8865 | 23 | /** Get concentration of LPG |
NXP_Rr | 2:c366191f8865 | 24 | * Returns the concentration of LPG as a floating number. |
NXP_Rr | 2:c366191f8865 | 25 | */ |
NXP_Rr | 0:7712450a546d | 26 | float getLPG_ppm(); |
NXP_Rr | 0:7712450a546d | 27 | |
NXP_Rr | 2:c366191f8865 | 28 | /** Get concentration of CO, |
NXP_Rr | 2:c366191f8865 | 29 | * Returns the concentration of CO as a floating number. |
NXP_Rr | 2:c366191f8865 | 30 | */ |
NXP_Rr | 0:7712450a546d | 31 | float getCO_ppm(); |
NXP_Rr | 0:7712450a546d | 32 | |
NXP_Rr | 2:c366191f8865 | 33 | /** Get concentration of Methane |
NXP_Rr | 2:c366191f8865 | 34 | * Returns the concentration of Methane as a floating number. |
NXP_Rr | 2:c366191f8865 | 35 | */ |
NXP_Rr | 0:7712450a546d | 36 | float getMethane_ppm(); |
NXP_Rr | 0:7712450a546d | 37 | |
NXP_Rr | 0:7712450a546d | 38 | private: |
NXP_Rr | 0:7712450a546d | 39 | /// Concentration of LPG |
NXP_Rr | 0:7712450a546d | 40 | float _LPG_ppm; |
NXP_Rr | 0:7712450a546d | 41 | /// Concentration of CO |
NXP_Rr | 0:7712450a546d | 42 | float _CO_ppm; |
NXP_Rr | 0:7712450a546d | 43 | /// Concentration of Methane |
NXP_Rr | 0:7712450a546d | 44 | float _Methane_ppm; |
NXP_Rr | 0:7712450a546d | 45 | |
NXP_Rr | 0:7712450a546d | 46 | /// pin to read the sensor information |
NXP_Rr | 0:7712450a546d | 47 | AnalogIn _pin; |
NXP_Rr | 0:7712450a546d | 48 | }; |
NXP_Rr | 0:7712450a546d | 49 | |
NXP_Rr | 0:7712450a546d | 50 | #endif |