mcp3208

Crates.iomcp3208
lib.rsmcp3208
version0.1.0
sourcesrc
created_at2020-05-20 00:06:04.81491
updated_at2020-05-20 00:06:04.81491
descriptionA MCP3208 sensor driver for Rust.
homepage
repositoryhttps://github.com/kawogi/rust-mcp3208
max_upload_size
id243634
size16,515
Kai Giebeler (kawogi)

documentation

README

rust-mcp3208

MCP3208 A/D converter

rust-mcp3208 is a library to read adc values from an MCP3208 via spi.

Usage

Cargo.toml
[dependencies]
mcp3208 = "1.0.0"
use mcp3208::{Mcp3208, Channel};

/// outputs the raw adc values of all channels
fn main() {
    if let Ok(mut mcp3208) = Mcp3208::new("/dev/spidev0.0") {
        Channel::VALUES.iter().for_each(|&channel| {
            println!("channel #{}: {}", channel as u8, mcp3208.read_adc_single(channel).unwrap());
        });
    }
}
Commit count: 19

cargo fmt