1
0
Fork 0
mirror of https://github.com/icewind1991/mhz19-rs synced 2026-06-03 09:34:12 +02:00

take tty path as arugment

This commit is contained in:
Robin Appelman 2019-09-06 21:55:54 +02:00
commit 630087ac72

View file

@ -2,13 +2,17 @@ use mhz19::MHZ19;
use std::time::Duration; use std::time::Duration;
use std::thread::sleep; use std::thread::sleep;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::env;
const DELAY: Duration = Duration::from_secs(1); const DELAY: Duration = Duration::from_secs(1);
fn main() { fn main() {
loop { match env::args().skip(1).next() {
listen("/dev/ttyUSB0"); Some(path) => loop {
listen(&path);
sleep(DELAY); sleep(DELAY);
},
None => eprintln!("Path required")
} }
} }