ASensor
 All Classes Functions Pages
MQ4MethaneGasSensor.h
1 #pragma once
2 /*
3  ASensor - Sensor library. Can be used standalone or in conjunction with AWind library
4  Copyright (C)2015 Andrei Degtiarev. All right reserved
5 
6  You can always find the latest version of the library at
7  https://github.com/AndreiDegtiarev/ASensor
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the MIT license.
11  Please see the included documents for further information.
12 */
14 class MQ4MethaneGasSensor : public ISensor
15 {
16  int _port;
17 
18 public:
19  MQ4MethaneGasSensor(int port)
20  {
21  _port=port;
22  }
23  const __FlashStringHelper* Name()
24  {
25  return F("MQ4MethaneGas");
26  }
27  float LowMeasurementLimit()
28  {
29  return 0;
30  }
31  float HighMeasurementLimit()
32  {
33  return 1024;
34  }
35  int Precission()
36  {
37  return 0;
38  }
39  bool Measure(float &data)
40  {
41  data=(int)analogRead(_port);
42  return true;
43  }
44 };
MQ4 methane gas sensor from sainsmart. No any external libraries are neccesary. Details to member fun...
Definition: MQ4MethaneGasSensor.h:14