Ramana R
/
MQ9
This is a library for the MQ9 gas sensor module.
Diff: MQ9.h
- Revision:
- 0:7712450a546d
- Child:
- 1:9a7fb445a7ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MQ9.h Tue May 01 20:26:00 2018 +0000 @@ -0,0 +1,44 @@ +#ifndef _____MQ9_____ +#define _____MQ9_____ + +#include "mbed.h" + +#define MQ9_STATUS_PASS 0 +#define MQ9_STATUS_FAIL -1 + +/** Class for the MQ9 sensor. + * This library is a modified version of the MQ2 library for Arduino + * Example: + * + */ +class MQ9 +{ +public: + /// Construct the sensor object and setup the sensor pins + MQ9(PinName const &p); + + /// Update the gas concentrations from the sensor. + int read(); + + /// Get concentration of LPG + float getLPG_ppm(); + + /// Get concentration of CO + float getCO_ppm(); + + /// Get concentration of Methane + float getMethane_ppm(); + +private: + /// Concentration of LPG + float _LPG_ppm; + /// Concentration of CO + float _CO_ppm; + /// Concentration of Methane + float _Methane_ppm; + + /// pin to read the sensor information + AnalogIn _pin; +}; + +#endif \ No newline at end of file