-
Notifications
You must be signed in to change notification settings - Fork 1
begin()
Arnd edited this page Aug 3, 2017
·
11 revisions
This function initializes the BME280 device and the parameters used, if any, determine which interface is used. The BME280 supports both I2C and SPI protocols. If called with no parameters the library assumes an I2C connection using address 0x77. The BME280 can have two possible addresses, either 0x76 when "SDO" is pulled to ground or 0x77 when "SDO" is pulled to VIn. If the alternate 0x76 address is used or a completely different address is specified (as can happen when using an I2C expander) then this can be passed to the begin() function.
BME280_Class BME280; // Instantiate class
...
while (!BME280.begin()) { // Loop until sensor found
Serial.println("Error, unable to find or identify BME280."); // Show error message
delay(5000); // Wait 5 seconds before retrying
} // of if-then we can't initialize or find the device