Closed PaulMerk closed 3 years ago
You need to create a byte array with the command that you want to send and then pass it over serial. Something like:
byte command[9] = {0xFF, 0x01, 0x99, 0x00, 0x00, 0x00, 0x07, 0xD0, 0x8F};
serial->write(command, 9);
Like in https://github.com/tobiasschuerg/MH-Z-CO2-Sensors/blob/master/MHZ.cpp#L116 Hope that helps.
See also the official documentation: https://www.arduino.cc/reference/en/language/functions/communication/serial/write/
I would like to adjust the measurement range from 5000 to 2000. quote:According to the MH-Z19B datasheet, you can configure the measurement range by putting the desired range in byte 3 and 4. However, unlike what the MH-Z19B datasheet says, you can set the range using the following command (in this case 0x07d0 = 2000 ppm in byte 6 and 7):
0xFF 0x01 0x99 0x00 0x00 0x00 0x07 0xD0 0x8F