-
Notifications
You must be signed in to change notification settings - Fork 11
SoftSPIDemo.ino
Arduino sketch to read and display measurements from the Bosch BME280 sensor. The sensor is connected to the Arduino using the 4 digital pins and the SPI programming is done directly in the library. See the Arduino's standard SPI library for a description of SPI.
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 program makes use of 4 standard digital pins for the 4 SPI connection - MOSI, MISO, SCK and CS. Any other unused digital pins can be substituted. The example above is for an Arduino ATMEga2560. The library has been tested on an Arduino Micro, Arduino ATMega 2560 and an Arduino UNO.
The BME680 is instantiated and initialised in the setup() method with the following explicit values:
- All 4 sensors (temperature, humidity and pressure) are turned on with 16x oversampling
- IIR filtering is turned on to 16x
After initialisation the program loops infinitely. It displays the temperature in degrees Celsius, the humidity in %, the pressure in hPa (hectopascal) and the ambient air quality as resistance in milliohms. The altitude is computed using a standard atmosphere of 1013.25 and is displayed in meters. After displaying the measurements the program pauses 5 seconds and repeats.
Every 10 cycles the humidity sensor's status is toggled between ON and OFF.
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