Class Mhz19b
MH-Z19B CO2 concentration sensor binding
[Interface("MH-Z19B CO2 concentration sensor binding")]
public sealed class Mhz19b
- Inheritance
-
Mhz19b
Constructors
Mhz19b(Stream, bool)
Initializes a new instance of the Mhz19b class using an existing (serial port) stream.
public Mhz19b(Stream stream, bool shouldDispose)
Parameters
stream
StreamExisting stream
shouldDispose
boolIf true, the stream gets disposed when disposing the binding
Mhz19b(string)
Initializes a new instance of the Mhz19b class and creates a new serial port stream.
public Mhz19b(string uartDevice)
Parameters
uartDevice
stringPath to the UART device / serial port, e.g. /dev/serial0
Exceptions
- ArgumentException
uartDevice is null or empty
Methods
Dispose()
Defines a method to release allocated resources.
public void Dispose()
GetCo2Reading()
Gets the current CO2 concentration from the sensor.
[Telemetry("Co2Concentration")]
public VolumeConcentration GetCo2Reading()
Returns
- VolumeConcentration
CO2 volume concentration
Exceptions
- IOException
Communication with sensor failed
- TimeoutException
A timeout occurred while communicating with the sensor
PerformSpanPointCalibration(VolumeConcentration)
Initiate a span point calibration.
[Command]
public void PerformSpanPointCalibration(VolumeConcentration span)
Parameters
span
VolumeConcentrationspan value, between 1000[ppm] and 5000[ppm]. The typical value is 2000[ppm].
Exceptions
- ArgumentException
Thrown when span value is out of range
- IOException
Communication with sensor failed
PerformZeroPointCalibration()
Initiates a zero point calibration.
[Command]
public void PerformZeroPointCalibration()
Exceptions
- IOException
Communication with sensor failed
SetAutomaticBaselineCorrection(AbmState)
Switches the autmatic baseline correction on and off.
[Command]
public void SetAutomaticBaselineCorrection(AbmState state)
Parameters
state
AbmStateState of automatic correction
Exceptions
- IOException
Communication with sensor failed
SetSensorDetectionRange(DetectionRange)
Set the sensor detection range.
[Property("DetectionRange")]
public void SetSensorDetectionRange(DetectionRange detectionRange)
Parameters
detectionRange
DetectionRangeDetection range of the sensor
Exceptions
- IOException
Communication with sensor failed