PlatformIO Community

How to transfer complete buffer that also contains 0x00h bytes via serial port

Hello all.
i have two transfer ty follwoing bytecode to an LEGO Motor Sensor : uint8_t ScanRsponseData[] ={0x5C,0x23,0x00,0x10,0x20,0x30,0x00,0x00,0x00,0x80};
I tried severall attempts, but every time, the Zeroes are removed, it seems that the are ignored when i try to send like Serial.write(ScanRsponseData,sizeof(ScanRsponseData));

Question is: How to send an byte buffer array, containing 0x00h as part of information message without beeing removed.

Or at some time, only the number of bytes in an array before the first 0x00h element is send, how to send complete buffer contents ?

Thanks in advance.

Your code:

uint8_t ScanRsponseData[] = { 0x5C, 0x23, 0x00, 0x10, 0x20, 0x30, 0x00, 0x00, 0x00, 0x80 };
Serial.write(ScanRsponseData, sizeof(ScanRsponseData));

is the correct way to transmit binary data. It will include the 0x00 bytes as well.

Why do you think they are not transmitted? How do you monitor the transmission?

problem was sitting in front of computer, solved :wink: