Skip to content

setIIRFilter()

Arnd edited this page Dec 12, 2020 · 5 revisions

[filterSetting=] iirFilter([iirModeToUse]);


This sets or returns the current IIR filter setting which is used to even out measurements. When called with no parameter the IIR setting is returned, values as listed below. If a parameter is specified the IIR filter is set accordingly. Either the enumerated type or corresponding numeric value as listed here can be used:

0 or IIROff to turn off IIR filtering
1 or IIR2 for 2x IIR filtering
2 or IIR4 for 4x IIR filtering
3 or IIR8 for 8x IIR filtering
4 or IIR16 to 16x IIR filtering
5 or IIR32 to 32x IIR filtering
6 or IIR64 to 64x IIR filtering
7 or IIR128 to 128x IIR filtering

Any other value is ignored.


Example:

BME680_Class BME680;  // Instantiate class    
...    
while (!BME680.begin()) {                          // Find on I2C bus
  Serial.println("Error, unable to find BME680."); // Show error message
  delay(5000);                                     // Wait 5 seconds 
} // of if-then we can't initialize or find the device
uint8 deviceMode = BME680.mode(NormalMode); // Set normal mode
BME280.iirFilter(IIR8); // Set IIR Filtering to 8x