pcf8591

Crates.iopcf8591
lib.rspcf8591
version0.1.1
sourcesrc
created_at2016-12-01 06:30:45.716301
updated_at2016-12-02 02:39:21.177241
descriptionA rust API for PCF8591 A/D converter
homepage
repositoryhttps://github.com/tafia/pcf8591-rs
max_upload_size
id7425
size5,909
Johann Tuffe (tafia)

documentation

https://docs.rs/pcf8591

README

pcf8591-rs

An API to connect to PCF8591 A/D converter.

Documentation

Example

use pcf8591::{PCF8591, Pin};
use std::thread;
use std::time::Duration;

// Gets default location on raspberry pi (rev 2)
let mut converter = PCF8591::new("/dev/i2c-1", 0x48, 3.3).unwrap();

loop {
    let v = converter.analog_read(Pin::AIN0).unwrap();
    println!("Input voltage at pin 0: {}", v);

    thread::sleep(Duration::from_millis(1000));
}
Commit count: 13

cargo fmt