| Crates.io | bosch-bme680 |
| lib.rs | bosch-bme680 |
| version | 1.0.4 |
| created_at | 2023-01-13 18:41:12.895625+00 |
| updated_at | 2025-02-10 23:31:14.492996+00 |
| description | A pure rust implementation for the BME680 environmental sensor |
| homepage | |
| repository | https://github.com/JakobLachermeier/bosch-bme680 |
| max_upload_size | |
| id | 758107 |
| size | 100,734 |
A pure rust driver for the Bosch BME680 environmental sensor that focuses on ease of use.
Mock i2c and delay have to be replaced with specific hardware crates.
fn main() -> ! {
let i2c = mock::blocking_i2c();
let delay = mock::MockDelay;
let config = bosch_bme680::Configuration::default();
let mut bme = Bme680::new(i2c, DeviceAddress::Primary, delay, &config, 20).unwrap();
thread::sleep(Duration::from_millis(100));
loop {
thread::sleep(Duration::from_secs(2));
let values = bme.measure().unwrap();
println!("Values: {values:?}\n");
}
}
embedded-hal-async usageThis crate has optional support for embedded-hal-async, which provides
asynchronous versions of the embedded-hal traits. To avoid an unnecessary
dependency on embedded-hal-async for projects which do not require it, the
embedded-hal-async support is an optional feature.
In order to use the embedded-hal-async driver, add the following to your
Cargo.toml:
[dependencies]
bosch-bme680 = { version = "1.0.3", features = ["embedded-hal-async"] }
Then, construct an instance of the AsyncBme680 struct using the
embedded_hal_async I2c and Delay traits.