pmsx003 1.0.0

Rust interface for PMS X003 air quality sensors
Documentation
// use linux_embedded_hal;

use pmsx003::*;
// use std::time::Duration;

fn main() {
    // This example requires linux-embedded-hal which is not available on macOS
    // Uncomment the following code when running on Linux:
    
    /*
    let path = std::env::args()
        .skip(1)
        .next()
        .expect("Missing path to device");

    println!("Connecting to: {}", path);

    let device = linux_embedded_hal::Serial::open(std::path::Path::new(&path)).unwrap();

    let mut sensor = PmsX003Sensor::new(device);

    sensor.passive().unwrap();
    std::thread::sleep(Duration::from_secs(1));
    sensor.request().unwrap();
    std::thread::sleep(Duration::from_secs(1));
    let frame = sensor.read().unwrap();

    println!("{:?}", frame);

    std::thread::sleep(Duration::from_secs(1));
    sensor.active().unwrap();
    std::thread::sleep(Duration::from_secs(1));

    loop {
        match sensor.read() {
            Ok(frame) => println!("{:?}", frame),
            Err(e) => println!("{:?}", e),
        }
    }
    */
    
    println!("This example is disabled on non-Linux platforms");
}