Hi,
I want to receive 9 bytes after each cycle
Im using the QSerialPort to comunicate between a reaspberry pi and an other device (microcontroller)
I write a code
I have perfectly 9 bytes after each cycle but not in the same QbyteArray :
for example :
nb data read = 9 bytes = "011109101809090913"
nb data read = 8 bytes = "0209091018090909"
nb data read = 1 bytes = "13"
nb data read = 8 bytes = "0309091018090908"
nb data read = 1 bytes = "13"
nb data read = 9 bytes = "04110910170909090f"
nb data read = 9 bytes = "050909101809090913"
nb data read = 9 bytes = "061509101809090813"
nb data read = 8 bytes = "0711091018080909"
nb data read = 10 bytes = "1308110910170908090f"
I want to receive exaclty 9 bytes :
If u see the example , you can remark that each byte have an ID(1,2,3....) and 8 other bytes
and when i have 8 bytes, the next byte is the end of the later (8 bytes) ..
i have this code
StopAff->setEnabled(true);
bytes = PortReception->readAll();
qDebug() <<"nb data read = " << bytes.size() << " bytes = "<< bytes.toHex();
StopAff->setEnabled(true);
QByteArray bytes;
bytes = PortReception->readAll();
qDebug() <<"nb data read = " << bytes.size() << " bytes = "<< bytes.toHex();
To copy to clipboard, switch view to plain text mode
How I can resolve the problem
Bookmarks