Hi everyone,
I am using an arduino uno board, and I've connected it to a MH-Z19B CO2 sensor with the TX RX pins. When I am using println, the first time it will always add some characters in the beginning when looking in the serial monitor. I think it is the return from the serial.write. Is it possible to turn this off? Or is this caused by something else?
In this case the output should be 2 times 255. However my output will look like this:
22:39:33.142 -> ⸮⸮y255
22:39:33.188 -> 255
void setup() {
Serial.begin(9600);
while (Serial.available() >0) {
Serial.read();
}
}
void loop() {
byte cmd[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
byte response[9];
Serial.write(cmd, 9);
Serial.readBytes(response, 9);
Serial.println(response[0]);
Serial.println(response[0]);
delay(1000);
}