Crate sensor_scd30

source ·
Expand description

Scd30 driver library

Copyright 2019 Ryan Kurte

use std::time::Duration;
use linux_embedded_hal::{I2cdev, Delay};
use sensor_scd30::Scd30;

// Open I2C port
let i2c = I2cdev::new("/dev/i2c-1").unwrap();

// Connect to sensor
let mut scd = Scd30::new(i2c, Delay{}).unwrap();

// Start continuous sampling mode
scd.start_continuous(10).unwrap();

// Poll for data
loop {
    // Keep looping until ready
    if scd.data_ready().unwrap() {
        continue;
    }

    // Fetch data when available
    let m = scd.read_data().unwrap();
    println!("Measurement: {:?}", m);
}

Modules§

  • Base communication implementation for interacting with Scd30 device
  • Scd30 device definitions

Structs§

  • Scd30 measurement object
  • Scd30 sensor object This is generic over an I2C connector and associated error type

Enums§