-
Notifications
You must be signed in to change notification settings - Fork 1
getOversampling()
Arnd edited this page Dec 11, 2020
·
3 revisions
oversamplingRate = getOversampling(sensor);
This returns the oversampling rate for one of the 3 different sensors on the BME280. The "sensor" parameter can be specified using an integer value as below or using the enumerated type:
- Use 0 or the enumerated variable TemperatureSensor
- Use 1 or the enumerated variable HumiditySensor
- Use 2 or the enumerated variable PressureSensor
The current oversampling rate is returned as an unsigned byte with the following numeric or enumerated type values:
- 0 or the enumerated variable SensorOff when sensor is turned off
- 1 or the enumerated variable Oversample1 for no oversampling
- 2 or the enumerated variable Oversample2 for 2x oversampling
- 3 or the enumerated variable Oversample4 for 4x oversampling
- 4 or the enumerated variable Oversample8 for 8x oversampling
- 5 or the enumerated variable Oversample16 for the maximum 16x oversampling
Any value other value is ignored.
BME280_Class BME280; // Instantiate class
...
while (!BME280.begin()) { // Find on I2C bus
Serial.println("Error, unable to find BME280."); // Show error message
delay(5000); // Wait 5 seconds
} // of if-then we can't initialize or find the device
BME280.setOversample(TemperatureSensor,Oversample16); // 16x sampling to temperature
uint8 deviceMode = BME280.mode(NormalMode); // Set normal mode
...
Serial.print("Oversampling for the temperature sensor is ");
Serial.println(BME280.getOversample(TemperatureSensor);