-
Notifications
You must be signed in to change notification settings - Fork 12
begin()
Arnd edited this page May 22, 2020
·
10 revisions
begin() call | Description |
---|---|
[success=] begin(); | Use I2C and auto-search for BME680 |
[success=] begin( I2CSpeed ); | Use I2C and the specified speed (see below) |
[success=] begin( I2CSpeed , I2CAddress ); | Use I2C with specific address |
[success=] begin( I2CAddress ); | Use I2C when value is 0x76 or 0x77 |
[success=] begin( SS ); | Use hardware SPI |
[success=] begin( SS , MISO , MOSI , SCK ); | Use software SPI |
This function initializes the BME680 device using one of the 3 available protocols:
-
I2C
By default the I2C address of the BME680 is hard-wired to 0x76 or 0x77. When called with no argument, the library will search the 2 possible I2C addresses until it finds a BME680. If given a single argument with a value of 0x76 or 0x77 that will be used as the I2C address to be used. If one argument is used and it is an unsigned 32 bit integer (uint32_t) then it used as the I2C speed. -
Hardware SPI
When called with just one parameter it will use hardware SPI and the pin parameter passed in is the SS pin, or "Slave Select" pin. This parameter must be an unsigned small integer, and pins 0x76 or 0x77 cannot be used, if present; as these two values are used to specify the I2C address when using the I2C communications protocol described above. -
Software SPI
When called with 4 parameters then software SPI is used and the 4 pins are assigned accordingly.
The function has an optional return value which is TRUE when the device has been located and initialized, otherwise a FALSE will be returned.
The I2C bus defaults to the slowest speed, 100KHz. The Bosch sensor can go much faster if desired, specify one of the following Constants in the optional I2CSpeed parameter.
Constant | Speed |
---|---|
I2C_STANDARD_MODE | 100KHz |
I2C_FAST_MODE | 400KHz |
I2C_FAST_MODE_PLUS | 1MHz |
I2C_HIGH_SPEED_MODE | 3.4MHz |
...
...
BME280_Class BME680; // Instantiate class
...
...
while (!BME680.begin(I2C_FAST_MODE_PLUS)) { // 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
...
...
Overview
Installation
Class Instantiation
begin()
setOversampling()
setIIRFilter()
setGas()
getSensorData()
getI2CAddress()
waitForReadings()
measuring()
triggerMeasurement()
reset()
-none-
Modes
Sensors
Oversampling
IIR Filters
I2CDemo.ino
SPIDemo.ino
SoftSPIDemo.ino
TwoDevicesI2CDemo.ino
SDLoggerSPIDemo.ino
ESP32FeatherWiFiDemo.ino