Skip to content

iirFilter()

Arnd edited this page Dec 11, 2020 · 4 revisions

[filterSetting=] iirFilter([iirModeToUse]);


This sets or returns the current [IIR](https://en.wikipedia.org/wiki/Infinite_impulse_response( 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 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

Any other value is ignored.


Example:

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
uint8 deviceMode = BME280.mode(NormalMode); // Set normal mode
BME280.iirFilter(IIR8); // Set IIR Filtering to 8x
Clone this wiki locally