This is a library for the MQ9 gas sensor module.

Dependencies:   mbed

MQ9.h

Committer:
NXP_Rr
Date:
2018-05-01
Revision:
1:9a7fb445a7ad
Parent:
0:7712450a546d
Child:
2:c366191f8865

File content as of revision 1:9a7fb445a7ad:

#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
    /// Returns the concentration of CO as a floating number
    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