Bryan Bates
/
Lab4_4180
MQ-7 Gas Sensor demo
MQ7.h
- Committer:
- bryanbates
- Date:
- 2016-10-31
- Revision:
- 1:6f35304675ae
- Parent:
- 0:ff650029fdf8
File content as of revision 1:6f35304675ae:
#ifndef MQ7_H #define MQ7_H #include "mbed.h" // Interface to control an MQ-7 (Carbon Monoxide) sensor class MQ7 { public: /** Create interfaces with gas sensor module * * @param alr A DigitalIn, alarm output to microcontroller * @param hsw A PwmOut, heat switch input from microcontroller, active low */ MQ7(PinName alr, PinName hsw) : _alr(alr), _hsw(hsw){} int getAlarm(){ return _alr.read(); } void setHeat(float voltage){ _hsw.write(voltage); } protected: DigitalIn _alr; PwmOut _hsw; }; #endif