-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathExample4_Settings.ino
58 lines (41 loc) · 1.62 KB
/
Example4_Settings.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
/*
Control the various settings of the BME280
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
This example shows how to set the various filter, and oversample settings of the BME280.
*/
#include <Wire.h>
#include "SparkFunBME280.h"
BME280 mySensor;
void setup()
{
Serial.begin(115200);
Serial.println("Example showing alternate I2C addresses");
Wire.begin();
Wire.setClock(400000); //Increase to fast I2C speed!
mySensor.beginI2C();
mySensor.setFilter(1); //0 to 4 is valid. Filter coefficient. See 3.4.4
mySensor.setStandbyTime(0); //0 to 7 valid. Time between readings. See table 27.
mySensor.setTempOverSample(1); //0 to 16 are valid. 0 disables temp sensing. See table 24.
mySensor.setPressureOverSample(1); //0 to 16 are valid. 0 disables pressure sensing. See table 23.
mySensor.setHumidityOverSample(1); //0 to 16 are valid. 0 disables humidity sensing. See table 19.
mySensor.setMode(MODE_NORMAL); //MODE_SLEEP, MODE_FORCED, MODE_NORMAL is valid. See 3.3
}
void loop()
{
Serial.print("Humidity: ");
Serial.print(mySensor.readFloatHumidity(), 0);
Serial.print(" Pressure: ");
Serial.print(mySensor.readFloatPressure(), 0);
Serial.print(" Alt: ");
//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);
}