si7021

Crates.iosi7021
lib.rssi7021
version0.2.0
sourcesrc
created_at2018-02-25 21:12:01.190621
updated_at2019-03-31 15:12:42.554873
descriptionI2C driver for the Si7021 hygrometer and thermometer
homepage
repositoryhttps://github.com/klemens/si7021-rs
max_upload_size
id52829
size5,041
Klemens Schölhorn (klemens)

documentation

https://docs.rs/si7021

README

si7021

A Rust I²C driver for the Si7021 hygrometer and thermometer.

Example

extern crate i2cdev;
extern crate si7021;
extern crate i2csensors;

use i2cdev::linux::LinuxI2CDevice;
use si7021::{Si7021, SI7021_I2C_ADDRESS};
use i2csensors::{Hygrometer, Thermometer};

fn main() {
    let device = LinuxI2CDevice::new("/dev/i2c-1", SI7021_I2C_ADDRESS).unwrap();
    let mut si7021 = Si7021::new(device);

    println!("humidity:    {:6.2} %", si7021.relative_humidity().unwrap());
    println!("temperature: {:6.2} °C", si7021.temperature_celsius().unwrap());
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 6

cargo fmt