Add missing sleep to example

One has to sleep for the duration of the configured profile to read
proper data.

Closes #23.
This commit is contained in:
Jan Gosmann 2021-05-06 19:59:40 +02:00 committed by marcelbuesing
parent f531e617d6
commit 1e9986d41c
No known key found for this signature in database
GPG key ID: 5E8C5624159F80BB

View file

@ -15,6 +15,7 @@
//! use hal::*;
//! use std::result;
//! use std::time::Duration;
//! use std::thread::sleep;
//!
//! # mod hal {
//! # use super::*;
@ -64,9 +65,11 @@
//! .with_run_gas(true)
//! .build();
//! dev.set_sensor_settings(&mut delayer, settings)?;
//! let profile_duration = dev.get_profile_dur(&settings.0)?;
//!
//! // Read sensor data
//! dev.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)?;
//! sleep(profile_duration);
//! let (data, _state) = dev.get_sensor_data(&mut delayer)?;
//!
//! println!("Temperature {}°C", data.temperature_celsius());