#bosch #run #adafruit #tested #module #following #barometer

bmp280

A simple library for using the Bosch BMP280 barometer and altimeter

6 releases (3 breaking)

0.4.0 Mar 11, 2021
0.3.0 Mar 10, 2021
0.2.1 Jul 15, 2016
0.1.2 Jul 15, 2016

#993 in Hardware support

24 downloads per month
Used in 2 crates

MIT license

14KB
312 lines

BMP280

A simple library for using the Bosch BMP280 barometer and altimeter.

The following example can be run using $ cargo run --example simple. This library has been tested on an Odroid-C4 using an Adafruit BMP280 module.

use bmp280::Bmp280Builder;

fn main() {
    let mut dev = Bmp280Builder::new()
        .path("/dev/i2c-1")
        .address(0x77)
        .build()
        .expect("Failed to build device");

    dev.zero().expect("Device failed to zero");

    loop {
        println!("{:?} kPa", dev.pressure_kpa().unwrap());
        println!("{:?} m", dev.altitude_m().unwrap());
        println!("{:?} c", dev.temperature_celsius().unwrap());
        std::thread::sleep(std::time::Duration::from_millis(250));
    }

}

lib.rs:

A simple library for using the Bosch BMP280 barometer and altimeter.

This library has been tested on an Odroid-C4 using an Adafruit BMP280 module.

Dependencies

~2MB
~39K SLoC