Bryan Bates / Mbed 2 deprecated Lab4_4180

Dependencies:   mbed

Dependents:   GloboMet

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQ7.h Source File

MQ7.h

00001 
00002 #ifndef MQ7_H
00003 #define MQ7_H
00004 
00005 #include "mbed.h"
00006 
00007 // Interface to control an MQ-7 (Carbon Monoxide) sensor 
00008 
00009 class MQ7 {
00010 public:
00011 
00012     /** Create interfaces with gas sensor module
00013      *
00014      * @param alr A DigitalIn, alarm output to microcontroller
00015      * @param hsw A PwmOut, heat switch input from microcontroller, active low
00016      */
00017     MQ7(PinName alr, PinName hsw) : _alr(alr), _hsw(hsw){}
00018     
00019     int getAlarm(){
00020         return _alr.read();
00021     }
00022     
00023     void setHeat(float voltage){
00024         _hsw.write(voltage);
00025     }
00026      
00027 
00028 protected:
00029     DigitalIn _alr;
00030     PwmOut _hsw;
00031 
00032 };
00033 
00034 #endif