-
Notifications
You must be signed in to change notification settings - Fork 11
TwoDevicesI2CDemo.ino
Arduino sketch to read and display measurements from 2 Bosch BME680 sensors on the I2C bus using the processor's I2C pins and the library uses the Arduino's standard I2C library. Example added in Version v1.0.5 of the library.
No special processor-dependent calls are used and thus this sketch should run on any of the Arduino systems. The serial port speed defaults to 115200 baud. The 2 I2C wires/pins (SDA and SCL) are in different locations dependent upon the processor or Arduino board in use and the example board shown above is for an Arduino Micro. The library has been tested on an Arduino Micro, Arduino ATMega 2560 and an Arduino UNO.
Breadboard example above using an Arduino Micro, an Adafruit 4-channel I2C-Safe Bi-directional logic level converter and two Sparkfun BME680 Breakout boards. Since the Arduino Micro is a 5V microprocessor and the BME680 breakout board is a 3V device, the SDA and SCL pins need to be level-shifted in both directions and care has to be taken to choose a logic level converter which is compatible with I2C as most are not.
The BME680s are instantiated and initialized in the setup() method with the following explicit values:
- Temperature and humidity sensors are turned on with 16x oversampling
- IIR filtering is turned on to 16x
- Pressure and Air Quality sensors are turned off
After initialization the program loops infinitely. It displays the temperature in degrees Celsius, the humidity in % for both devices. The program then pauses 10 seconds and repeats.
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