Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
extern crate kxcj9;
extern crate linux_embedded_hal as hal;
use kxcj9::{Kxcj9, SlaveAddr};
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let address = SlaveAddr::default();
let mut sensor = Kxcj9::new_kxcj9_1018(dev, address);
sensor.enable().unwrap();
loop {
let acc = sensor.read().unwrap();
println!("X: {:2}, Y: {:2}, Z: {:2}", acc.x, acc.y, acc.z);
}
}