fixed typoes in readme and fixed error in MHZ.cpp files (#24)

* correct the type of sensor in readme

* fix overflow in int datatype in arduino Uno.
In Uno, it's 16 bits in int variable. So I add a explicit type cast in MHZ.cpp file

* fix the warning of implicit convert from hex to char.
I change the data type to unit_8t, and it also helps to unify the datatype of these cmd arrays.
This commit is contained in:
牧羊犬真Q 2021-09-28 16:15:22 +08:00 committed by GitHub
parent d2dbf58947
commit 7be7cf0f22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -14,8 +14,8 @@ const int MHZ_10K = 3;
const unsigned long MHZ14A_PREHEATING_TIME = 3L * 60L * 1000L;
const unsigned long MHZ19B_PREHEATING_TIME = 3L * 60L * 1000L;
const unsigned long MHZ14A_RESPONSE_TIME = 60 * 1000;
const unsigned long MHZ19B_RESPONSE_TIME = 120 * 1000;
const unsigned long MHZ14A_RESPONSE_TIME = (unsigned long)60 * 1000;
const unsigned long MHZ19B_RESPONSE_TIME = (unsigned long)120 * 1000;
const int STATUS_NO_RESPONSE = -2;
const int STATUS_CHECKSUM_MISMATCH = -3;
@ -286,7 +286,7 @@ void MHZ::setRange(int range) //only available for MHZ-19B < 1.6 and MH-Z 14a
void MHZ::calibrateZero()
{
char cmd[9] = {0xFF, 0x01, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78};
uint8_t cmd[9] = {0xFF, 0x01, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78};
_serial->write(cmd,9);
}

View file

@ -1,6 +1,6 @@
# MH-Z14A, MH-Z19B CO2 ... Module
Arduino implementation for MH-Z CO2 sensors such as **MH-Z14A**, **MH-Z18B** (as I didn't find all info in one place).
Arduino implementation for MH-Z CO2 sensors such as **MH-Z14A**, **MH-Z19B** (as I didn't find all info in one place).
The sensor is available for ~20 bucks at the usual places.