ina3221/examples/current.rs
2025-01-16 13:29:25 +01:00

11 lines
295 B
Rust

use ina3221;
fn main() {
let mut ina = ina3221::Ina3221::new(0x40, "/dev/i2c-1", 5.0);
let res = match ina.current(ina3221::Channel::One) {
Ok(value) => value,
Err(error) => panic!("Can't read i2c: {error:?}"),
};
println!("Channel one current: {:?} A", res);
}