-
Notifications
You must be signed in to change notification settings - Fork 0
/
BMP180Device.h
59 lines (52 loc) · 1.65 KB
/
BMP180Device.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef BMP180DEVICE_H
#define BMP180DEVICE_H
#include <Arduino.h>
#include <SFE_BMP180.h>
#include <Wire.h>
/* COPY-PASTE Documentation from Example Sketch:
* This sketch shows how to use the Bosch BMP180 pressure sensor
* as an altimiter. https://www.sparkfun.com/products/11824
*
* Like most pressure sensors, the BMP180 measures absolute pressure.
* Since absolute pressure varies with altitude, you can use the pressure
* to determine your altitude.
*
* Because pressure also varies with weather, you must first take a pressure
* reading at a known baseline altitude. Then you can measure variations
* from that pressure
* Hardware connections:
* - (GND) to GND
* + (VDD) to 3.3V
* (WARNING: do not connect + to 5V or the sensor will be damaged!)
*
* You will also need to connect the I2C pins (SCL and SDA) to your
* Arduino. The pins are different on different Arduinos:
*
* Any Arduino pins labeled: SDA SCL
* Uno, Redboard, Pro: A4 A5
* Mega2560, Due: 20 21
* Leonardo: 2 3
*
*
* ACCURACY NOTES: Altitude measurement has a noise of around 3.33ft.
*/
class BMP180Device {
public:
BMP180Device();
~BMP180Device();
void getData();
String getDisplayablePressureMb();
String getDisplayableTemperatureF();
String getDisplayableAltitudeFt();
private:
const String classname = "[BMP180Device]";
const double CONST_AVG_PRS_MBAR_AT_SEA_LEVEL = 1013.25; //mbar (hPa)
SFE_BMP180 sensor;
double baselinePressure;
double altitudeMeters;
double pressureMb;
double temperatureC;
void logmsg(String msg);
double getPressure();
};
#endif