[−][src]Struct mhz19::MHZ19
mh-z19 CO₂ sensor
Usage
use mhz19::MHZ19; fn main() { let mut mhz19 = MHZ19::open("/dev/ttyUSB0").unwrap(); println!("CO₂ readout: {} ppm", mhz19.read().unwrap()); }
Methods
impl MHZ19
[src]
pub fn open<T: AsRef<OsStr> + ?Sized>(port: &T) -> Result<Self>
[src]
Connect to the mh-z19 at the specified serial port
pub fn read(&mut self) -> Result<u16>
[src]
Read the CO2 value from the meter as ppm
Blocking
This command will wait for 100ms between sending the read command and getting the response during this the thread is blocked
If the crc check of the response fails the method will retry up to 8 times
pub fn zero_calibrate(&mut self) -> Result<()>
[src]
Tell the mh-z19 to zero-point calibrate
Sensor should be at 400ppm when calibrating
pub fn span_calibrate(&mut self, value: u16) -> Result<()>
[src]
Tell the mh-z19 to span-point calibrate
Sensor should be at target level when calibrating
pub fn enable_abc(&mut self, enable: bool) -> Result<()>
[src]
Enable or disable automatic baseline correction
Automatic baseline correction will automatically adjust the baseline value every 24h after power on to the "standard" value of 400ppm based on the lowest values measured each cycle.
This is suitable for situations like home or office buildings where no people are present for multiple hours each day allowing the CO₂ values to come down to outside levels
For units produced after 2015 this should be enabled by default
pub fn set_range(&mut self, range: Range) -> Result<()>
[src]
Set the detection range for the sensor
A range of 2000ppm or 5000ppm is supported
Auto Trait Implementations
impl Sync for MHZ19
impl Send for MHZ19
impl Unpin for MHZ19
impl UnwindSafe for MHZ19
impl RefUnwindSafe for MHZ19
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,