-
Notifications
You must be signed in to change notification settings - Fork 1
mode()
Arnd edited this page Dec 11, 2020
·
4 revisions
[newMode=] mode([modeToUse]);
This sets or returns the operating mode of the BME280. When called with no parameter the current mode is returned, when called with a valid mode the mode is set and that value is returned. The return value is optional. The BME280 has the following operating modes and an enumerated type has clear-text values which can be used instead of the numeric equivalents:
-
Sleep Mode
This is the default mode on power-up and can be set using the keyword SleepMode or the value 0. In this mode the BME280 is in low-energy consumption mode and will not perform any measurements until the mode is changed to one of the following. -
Forced Mode
When this mode is set using either the keyword ForcedMode or the values 1 or 2 (both have identical effects) it will force one set of measurments to be performed and then the mode will be switched back to SleepMode. -
NormalMode
This will continually cycle through measurements according to the register settings. It is set using the keyword NormalMode or the value 3.
Any value apart from 0, 1, 2 or 3 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
uint8 deviceMode = BME280.mode(NormalMode); // Set normal mode
Serial.print("BME280 mode is now ");
Serial.println(deviceMode);