Access MHZ19 sensor via serial port. More...
#include <Uart.h>
Public Member Functions | |
Uart (HardwareSerial &serial) | |
Use device in UART mode. More... | |
void | setSensorNumber (uint8_t num) |
Change sensor number field. More... | |
uint8_t | getSensorNumber () const |
Get currently configured sensor number. More... | |
void | setAutoCalibration (bool enable) |
Enable/disable zero-point auto-calibration feature. On by default. More... | |
void | calibrateZero () |
Calibrate zero point manually. More... | |
void | calibrateSpan (uint16_t ppm) |
Calibrate span point. More... | |
void | setDetectionRange (DetectionRange range) |
MHZ-19B has configurable detection range. More... | |
bool | getMeasurement (MeasurementCallback callback) |
Read measurement from device. More... | |
Protected Member Functions | |
void | sendRequest (Request &request) |
Detailed Description
Access MHZ19 sensor via serial port.
Constructor & Destructor Documentation
◆ Uart()
|
inline |
Use device in UART mode.
- Parameters
-
serial Port and pins must be pre-configured
Member Function Documentation
◆ calibrateSpan()
void MHZ19::Uart::calibrateSpan | ( | uint16_t | ppm | ) |
Calibrate span point.
Typical calibration value is 2000ppm, but must be above 1000ppm. Refer to datasheet for detailed procedure.
◆ calibrateZero()
void MHZ19::Uart::calibrateZero | ( | ) |
Calibrate zero point manually.
Sensor must be in stable 400ppm CO2 environment. Refer to datasheet for detailed procedure.
◆ getMeasurement()
bool MHZ19::Uart::getMeasurement | ( | MeasurementCallback | callback | ) |
Read measurement from device.
◆ getSensorNumber()
|
inline |
Get currently configured sensor number.
◆ sendRequest()
|
protected |
◆ setAutoCalibration()
void MHZ19::Uart::setAutoCalibration | ( | bool | enable | ) |
Enable/disable zero-point auto-calibration feature. On by default.
Calibrates 400ppm zero point reference automatically at power-on and every 24 hours. Suitable for home/office environment only. Refer to datasheet for details.
◆ setDetectionRange()
void MHZ19::Uart::setDetectionRange | ( | DetectionRange | range | ) |
MHZ-19B has configurable detection range.
◆ setSensorNumber()
|
inline |
Change sensor number field.
Original datasheet identifies first byte as sensor number, others as 'reserved'. Provided if this value changes in future hardware versions.
The documentation for this class was generated from the following file: