Skip to content

measurementTime()

Arnd edited this page Dec 11, 2020 · 2 revisions

microsTime= measurementTime([option]);


This returns the time in microseconds as an unsigned int32 in which the current settings in normal mode will take for one measurement cycle. This include times it takes to measure temperature, humidity and pressure as well as the inactive time between measurement in normal mode. The datasheet for the BME280 specifies both a typical and a maximum time, and the option is an enumerated type or numeric values as listed here can be used:

0 or TypicalMeasure for typical times, and
1 or MaximumMeasure for maximual time.


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 = mode(NormalMode); // Set normal mode
inactiveTime(inactive250ms); // Set inactive time between measures
BME280.setOversampling(TemperatureSensor,Oversample16);
BME280.setOversampling(HumiditySensor,   Oversample16);
BME280.setOversampling(PressureSensor,   Oversample16);
BME280.iirFilter(IIR16);
Serial.print(F("Measurement cycle will take "));
Serial.print(BME280.measurementTime(MaximumMeasure)/1000);
Serial.println(F("ms."));
Clone this wiki locally