-
Notifications
You must be signed in to change notification settings - Fork 0
/
BME.cpp
71 lines (56 loc) · 1.38 KB
/
BME.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// #include <Adafruit_BME280.h>
#include "BME.h"
#include "Adafruit_BME280.h"
// #include <Adafruit_Sensor.h>
BME::BME()
{
}
uint8_t BME::begin(uint8_t ADR_)
{
ADR = ADR_;
Sensor.begin(ADR);
}
float BME::getPressure() //Get pressure in mBar
{
return Sensor.readPressure()*0.01; //Convert to mBar
}
float BME::getHumidity() //Return humidity in % (realtive)
{
return Sensor.readHumidity();
}
float BME::getTemperature() //Return temp in C
{
return Sensor.readTemperature();
}
String BME::getHeader()
{
return "Pressure Atmos [mBar], Humidity [%], Temp Atmos [C],";
}
String BME::getString()
{
return String(GetPressure()) + "," + String(GetHumidity()) + "," + String(GetTemperature()) + ",";
}
/////////////////////////////////////////////
// PascalCase: FOR BACKWARDS COMPATIBILITY //
/////////////////////////////////////////////
// This case should be used for classes and objects
float BME::GetPressure() //Get pressure in mBar
{
return Sensor.readPressure()*0.01; //Convert to mBar
}
float BME::GetHumidity() //Return humidity in % (realtive)
{
return Sensor.readHumidity();
}
float BME::GetTemperature() //Return temp in C
{
return Sensor.readTemperature();
}
String BME::GetHeader()
{
return "Pressure Atmos [mBar], Humidity [%], Temp Atmos [C],";
}
String BME::GetString()
{
return String(GetPressure()) + "," + String(GetHumidity()) + "," + String(GetTemperature()) + ",";
}