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.
Dependents: BME280_SPI_Hello TYBLE16_simple_data_logger mpl115a2_display_local GS_final
Fork of BME280 by
BME280_SPI Class Reference
Interface for controlling BME280 Combined humidity and pressure sensor. More...
#include <BME280_SPI.h>
Public Member Functions | |
| BME280_SPI (PinName mosi, PinName miso, PinName sclk, PinName cs) | |
| Create a BME280 instance which is connected to specified SPI pins. | |
| virtual | ~BME280_SPI () |
| Destructor of BME280_SPI. | |
| 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_SPI.h" Serial pc(USBTX, USBRX); BME280_SPI sensor(D11, D12, D13, D9); // mosi, miso, sclk, cs int main() { while(1) { pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); wait(1); } }
BME280_SPI class
BME280_SPI: A library to correct environmental data using Boshe BME280 environmental sensor device
Definition at line 69 of file BME280_SPI.h.
Constructor & Destructor Documentation
| BME280_SPI | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk, | ||
| PinName | cs | ||
| ) |
Create a BME280 instance which is connected to specified SPI pins.
- Parameters:
-
mosi SPI MOSI pin miso SPI MISO pin sclk SPI SCLK pin cs device CS pin
Definition at line 27 of file BME280_SPI.cpp.
| ~BME280_SPI | ( | ) | [virtual] |
Destructor of BME280_SPI.
Definition at line 37 of file BME280_SPI.cpp.
Member Function Documentation
| float getHumidity | ( | void | ) |
Read the current humidity value (humidity %) from BME280 sensor.
- Returns:
- Humidity value (humidity %)
Definition at line 194 of file BME280_SPI.cpp.
| float getPressure | ( | void | ) |
Read the current pressure value (hectopascal) from BME280 sensor.
- Returns:
- Pressure value (hectopascal)
Definition at line 154 of file BME280_SPI.cpp.
| float getTemperature | ( | void | ) |
Read the current temperature value (degree Celsius) from BME280 sensor.
- Returns:
- Temperature value (degree Celsius)
Definition at line 127 of file BME280_SPI.cpp.
| void initialize | ( | void | ) |
Initializa BME280 sensor.
Configure sensor setting and read parameters for calibration
Definition at line 41 of file BME280_SPI.cpp.
Generated on Tue Jul 12 2022 22:08:35 by
1.7.2
