Native pico-sdk BMP280 temperature sensor and air pressure sensor library for Raspberry Pi Pico in C++by darren horrocks
The BMP280 works as an ambient temperature sensor and air pressure sensor, and is available as either a standalone IC, or as a breakout board and is usually conntected up via I2C (IIC, ICC or I2C, depending on your preference). I have written a bmp280 raspberry pi pico library as part of a group of libraries over at the pico-libs repository on github.
The library is easy to use and is easily includable in your project via cmake, and libraries are added in, in the same way that you add in the individual libraries from the pico-sdk its self.
You will first need to check out the pico-libs repository, and then copy external/pico_libs_import.cmake from the repository to the root of your firmware application.
You can add the library from the pico-lib’s adding
bmp280 onto the end of your target_link_libraries in cmake:
target_link_libraries([your executable] pico_stdlib bmp280)
You can then include “bmp280.h” and use the following methods from the
- readAltitude(float seaLevelhPa = 1013.25);
- seaLevelForAltitude(float altitude, float atmospheric);