Add get_rpm and get_speed

This commit is contained in:
Robert Sammelson 2023-05-14 22:16:28 -04:00
parent 4e8bfd38d1
commit 559fbbaa12
No known key found for this signature in database
GPG key ID: 92F1F04EDB06B9E9
3 changed files with 54 additions and 5 deletions

View file

@ -3,6 +3,8 @@
mod obd2;
use obd2::Obd2Device;
use std::time;
fn main() {
env_logger::init();
let mut device: obd2::Obd2<obd2::Elm327> = obd2::Obd2::default();
@ -20,4 +22,10 @@ fn main() {
}
}
}
let state = time::Instant::now();
while state.elapsed() < time::Duration::from_secs(5) {
println!("RPM: {:?}", device.get_rpm());
println!("Speed: {:?}", device.get_speed());
}
}