This is a library for the MQ9 gas sensor module.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQ9.h Source File

MQ9.h

00001 #ifndef _____MQ9_____
00002 #define _____MQ9_____
00003 
00004 #include "mbed.h"
00005 
00006 #define MQ9_STATUS_PASS 0
00007 #define MQ9_STATUS_FAIL -1
00008 
00009 /** Class for the MQ9 sensor.
00010  *  This library is a modified version of the MQ2 library for Arduino 
00011  * Example:
00012  * 
00013  */ 
00014 class MQ9
00015 {
00016 public:
00017     /// Construct the sensor object and setup the sensor pins
00018     MQ9(PinName const &p);
00019     
00020     /// Update the gas concentrations from the sensor.
00021     int read();
00022     
00023     /** Get concentration of LPG
00024     *     Returns the concentration of LPG as a floating number.
00025     */
00026     float getLPG_ppm();
00027     
00028     /** Get concentration of CO,
00029     *    Returns the concentration of CO as a floating number.
00030     */
00031     float getCO_ppm();
00032     
00033     /** Get concentration of Methane
00034     *    Returns the concentration of Methane as a floating number.
00035     */
00036     float getMethane_ppm();
00037 
00038 private:
00039     /// Concentration of LPG
00040     float _LPG_ppm;
00041     /// Concentration of CO
00042     float _CO_ppm;
00043     /// Concentration of Methane
00044     float _Methane_ppm;
00045     
00046     /// pin to read the sensor information
00047     AnalogIn _pin;
00048 };
00049 
00050 #endif