mirror of
https://codeberg.org/icewind/pms700x.git
synced 2026-06-03 10:04:13 +02:00
sleep in passive read example
This commit is contained in:
parent
1cc3ae3f2d
commit
1b2e248126
1 changed files with 3 additions and 0 deletions
|
|
@ -3,11 +3,14 @@ use nb::block;
|
||||||
use pms700x::Pms700X;
|
use pms700x::Pms700X;
|
||||||
use std::env::args;
|
use std::env::args;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let port = args().skip(1).next().expect("No serial provided");
|
let port = args().skip(1).next().expect("No serial provided");
|
||||||
let serial = Serial::open(&PathBuf::from(port)).unwrap();
|
let serial = Serial::open(&PathBuf::from(port)).unwrap();
|
||||||
|
|
||||||
let mut pms = Pms700X::new(serial).into_passive().unwrap();
|
let mut pms = Pms700X::new(serial).into_passive().unwrap();
|
||||||
|
sleep(Duration::from_millis(50));
|
||||||
dbg!(block!(pms.read()).unwrap());
|
dbg!(block!(pms.read()).unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue