Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (10 sloc) 363 Bytes
extern crate linux_embedded_hal as hal;
extern crate tmp1x2;
use tmp1x2::{SlaveAddr, Tmp1x2};
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let address = SlaveAddr::default();
let mut sensor = Tmp1x2::new(dev, address);
let temperature = sensor.read_temperature().unwrap();
println!("Temperature: {:.1}ºC", temperature);
}
You can’t perform that action at this time.