Crates.io | bmp280 |
lib.rs | bmp280 |
version | 0.4.0 |
source | src |
created_at | 2016-07-14 01:36:52.438141 |
updated_at | 2021-03-11 06:38:56.252058 |
description | A simple library for using the Bosch BMP280 barometer and altimeter |
homepage | https://github.com/natemara/bmp280 |
repository | https://github.com/natemara/bmp280 |
max_upload_size | |
id | 5662 |
size | 17,609 |
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));
}
}