11
Setup()
In the Setup(), we start a serial communication at baud rate
115200
.
Serial.
begin
(
115200
)
;
Estimate the altitude in meters, based on the pressure at the sea level. 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
myBME280.
setReferencePressure
(
101500
)
;
//Adjust the sea level pressure used
for altitude calculations
Initializing the Sensors
BME280
if (
myBME280.
beginI2C
()
==
false)
//Begin communication over I2C
{
Serial.
println
("BME280 sensor did not respond. Please check wiring.
Freezing..."
)
;
while(
1
)
;
//Freeze
}
CCS811
if (
myCCS811
.begin
()
==
false)
{
Serial.
(
"CCS811 error did not respond. Please check wiring.
Freezing..."
)
;
while(
1
)
;
}