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