Skip to content

scttnlsn/ina219

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ina219

Travis CI Status crates.io

INA219 current/power monitor driver for Rust

Example

extern crate ina219;
extern crate linux_embedded_hal as hal;

use hal::I2cdev;
use ina219::{INA219, INA219_ADDR};

fn main() {
    let device = I2cdev::new("/dev/i2c-1").unwrap();
    let mut ina = INA219::new(device, INA219_ADDR);

    ina.calibrate(0x0100).unwrap();

    let voltage = ina.voltage().unwrap();
    println!("bus voltage: {:?}", voltage);

    let shunt_voltage = ina.shunt_voltage().unwrap();
    println!("shunt voltage: {:?}", shunt_voltage);

    let current = ina.current().unwrap();
    println!("current: {:?}", current);

    let power = ina.power().unwrap();
    println!("power: {:?}", power);
}

About

INA219 current/power monitor driver for Rust

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages