-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbmp180.ino
64 lines (52 loc) · 1.99 KB
/
bmp180.ino
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
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
/* You should also assign a unique ID to this sensor for use with
the Adafruit Sensor API so that you can identify this particular
sensor in any data logs, etc. To assign a unique ID, simply
provide an appropriate value in the constructor below (12345
is used by default in this example).
*/
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
/**************************************************************************/
/*
Displays some basic information on this sensor from the unified
sensor API sensor_t type (see Adafruit_Sensor for more information)
*/
/**************************************************************************/
void bmp180_check(void)
{
if(!bmp.begin())
{
/* There was a problem detecting the BMP085 ... check your connections */
Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
while(1);
}
sensor_t sensor;
bmp.getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print ("Sensor: "); Serial.println(sensor.name);
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" hPa");
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" hPa");
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" hPa");
Serial.println("------------------------------------");
Serial.println("");
delay(500);
}
void pressione()
{
/* Get a new sensor event */
sensors_event_t event;
bmp.getEvent(&event);
BP = event.pressure;
// /* Display the results (barometric pressure is measure in hPa) */
// if (event.pressure)
// {
// /* Display atmospheric pressue in hPa */
// Serial.print("Pressure: ");
// Serial.print(event.pressure);
// Serial.println(" hPa");
//
// }
}