- Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathExample8_LocalPressure.ino
59 lines (42 loc) · 1.59 KB
/
Example8_LocalPressure.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
/*
Adjust the local Reference Pressure
Nathan Seidle @ SparkFun Electronics
March 23, 2018
Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/14348 - Qwiic Combo Board
https://www.sparkfun.com/products/13676 - BME280 Breakout Board
'Sea level' pressure changes with high and low pressure weather movement.
This sketch demonstrates how to change sea level 101325Pa to a different value.
See Issue 1: https://github.com/sparkfun/SparkFun_BME280_Arduino_Library/issues/1
Google 'sea level pressure map' for more information:
http://weather.unisys.com/surface/sfc_con.php?image=pr&inv=0&t=cur
https://www.atmos.illinois.edu/weather/tree/viewer.pl?launch/sfcslp
29.92 inHg = 1.0 atm = 101325 Pa = 1013.25 mb
*/
#include<Wire.h>
#include"SparkFunBME280.h"
BME280 mySensor;
voidsetup()
{
Serial.begin(115200);
Serial.println("Example showing alternate I2C addresses");
Wire.begin();
Wire.setClock(400000); //Increase to fast I2C speed!
mySensor.beginI2C();
mySensor.setReferencePressure(101200); //Adjust the sea level pressure used for altitude calculations
}
voidloop()
{
Serial.print("Humidity: ");
Serial.print(mySensor.readFloatHumidity(), 0);
Serial.print(" Pressure: ");
Serial.print(mySensor.readFloatPressure(), 0);
Serial.print(" Locally Adjusted Altitude: ");
//Serial.print(mySensor.readFloatAltitudeMeters(), 1);
Serial.print(mySensor.readFloatAltitudeFeet(), 1);
Serial.print(" Temp: ");
//Serial.print(mySensor.readTempC(), 2);
Serial.print(mySensor.readTempF(), 2);
Serial.println();
delay(50);
}