Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
Generated on Tue Jul 12 2022 19:53:02 by
1.7.2