Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BOX_1
BME280 Class Reference
Interface for controlling BME280 Combined humidity and pressure sensor. More...
#include <BME280.h>
Public Member Functions | |
| BME280 (PinName sda, PinName sck, char slave_adr=DEFAULT_SLAVE_ADDRESS) | |
| Create a BME280 instance which is connected to specified I2C pins with specified address. | |
| BME280 (I2C &i2c_obj, char slave_adr=DEFAULT_SLAVE_ADDRESS) | |
| Create a BME280 instance which is connected to specified I2C pins with specified address. | |
| virtual | ~BME280 () |
| Destructor of BME280. | |
| void | initialize (void) |
| Initializa BME280 sensor. | |
| float | getTemperature (void) |
| Read the current temperature value (degree Celsius) from BME280 sensor. | |
| float | getPressure (void) |
| Read the current pressure value (hectopascal)from BME280 sensor. | |
| float | getHumidity (void) |
| Read the current humidity value (humidity %) from BME280 sensor. | |
Detailed Description
Interface for controlling BME280 Combined humidity and pressure sensor.
#include "mbed.h" #include "BME280.h" Serial pc(USBTX, USBRX); #if defined(TARGET_LPC1768) BME280 sensor(p28, p27); #else BME280 sensor(I2C_SDA, I2C_SCL); #endif int main() { while(1) { pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); wait(1); } }
BME280 class
BME280: A library to correct environmental data using Boshe BME280 environmental sensor device
Definition at line 53 of file BME280.h.
Constructor & Destructor Documentation
| BME280 | ( | PinName | sda, |
| PinName | sck, | ||
| char | slave_adr = DEFAULT_SLAVE_ADDRESS |
||
| ) |
Create a BME280 instance which is connected to specified I2C pins with specified address.
- Parameters:
-
sda I2C-bus SDA pin scl I2C-bus SCL pin slave_adr (option) I2C-bus address (default: 0x76)
Definition at line 4 of file BME280.cpp.
| BME280 | ( | I2C & | i2c_obj, |
| char | slave_adr = DEFAULT_SLAVE_ADDRESS |
||
| ) |
Create a BME280 instance which is connected to specified I2C pins with specified address.
- Parameters:
-
i2c_obj I2C object (instance) slave_adr (option) I2C-bus address (default: 0x76)
Definition at line 14 of file BME280.cpp.
| ~BME280 | ( | ) | [virtual] |
Destructor of BME280.
Definition at line 24 of file BME280.cpp.
Member Function Documentation
| float getHumidity | ( | void | ) |
Read the current humidity value (humidity %) from BME280 sensor.
Definition at line 152 of file BME280.cpp.
| float getPressure | ( | void | ) |
Read the current pressure value (hectopascal)from BME280 sensor.
Definition at line 114 of file BME280.cpp.
| float getTemperature | ( | void | ) |
Read the current temperature value (degree Celsius) from BME280 sensor.
Definition at line 89 of file BME280.cpp.
| void initialize | ( | void | ) |
Initializa BME280 sensor.
Configure sensor setting and read parameters for calibration
Definition at line 30 of file BME280.cpp.
Generated on Sat Jul 16 2022 00:45:31 by
1.7.2