#include <src/sensors/BoschBME280.h>
BoschBME280
class
The Sensor sub-class for the Bosch BME280.
- Reference
- Detailed Descriptions
Base classes
- class Sensor
- The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.
Constructors, destructors, conversion operators
- BoschBME280(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x76, uint8_t measurementsToAverage = 1)
- Construct a new Bosch BME280 object using a secondary hardware I2C instance.
- BoschBME280(int8_t powerPin, uint8_t i2cAddressHex = 0x76, uint8_t measurementsToAverage = 1) explicit
- Construct a new Bosch BME280 object using the primary hardware I2C instance.
- ~BoschBME280()
- Destroy the Bosch BME280 object.
Public functions
- bool wake(void) -> bool override
- Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.
- bool setup(void) -> bool override
- Do any one-time preparations needed before the sensor will be able to take readings.
- String getSensorLocation(void) -> String override
- Get the pin or connection location between the mcu and the sensor.
- bool addSingleMeasurementResult(void) -> bool override
- Get the results from a single measurement.
Function documentation
BoschBME280:: BoschBME280(TwoWire* theI2C,
int8_t powerPin,
uint8_t i2cAddressHex = 0x76,
uint8_t measurementsToAverage = 1)
Construct a new Bosch BME280 object using a secondary hardware I2C instance.
Parameters | |
---|---|
theI2C | A TwoWire instance for I2C communication. Due to the limitations of the Arduino core, only a hardware I2C instance can be used. For an AVR board, there is only one I2C instance possible and this form of the constructor should not be used. For a SAMD board, this can be used if a secondary I2C port is created on one of the extra SERCOMs. |
powerPin | The pin on the mcu controlling power to the BME280 Use -1 if it is continuously powered.
|
i2cAddressHex | The I2C address of the BME280; must be either 0x76 or 0x77. The default value is 0x76. |
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
BoschBME280:: BoschBME280(int8_t powerPin,
uint8_t i2cAddressHex = 0x76,
uint8_t measurementsToAverage = 1) explicit
Construct a new Bosch BME280 object using the primary hardware I2C instance.
Parameters | |
---|---|
powerPin | The pin on the mcu controlling power to the BME280 Use -1 if it is continuously powered.
|
i2cAddressHex | The I2C address of the BME280; must be either 0x76 or 0x77. The default value is 0x76. |
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
bool BoschBME280:: wake(void) override
Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.
Returns | bool True if the wake function completed successfully. |
---|
Verifies that the power is on and updates the _
bool BoschBME280:: setup(void) override
Do any one-time preparations needed before the sensor will be able to take readings.
Returns | bool True if the setup was successful. |
---|
This begins the Wire library (sets pin modes for I2C), reads calibration coefficients from the BME280, and updates the _
String BoschBME280:: getSensorLocation(void) override
Get the pin or connection location between the mcu and the sensor.
Returns | String Text describing how the sensor is attached to the mcu. |
---|
bool BoschBME280:: addSingleMeasurementResult(void) override
Get the results from a single measurement.
Returns | bool True if the function completed successfully. |
---|
This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.
This also un-sets the _