First, try to use [CODE] tags please, your code will be so more readable.
Then I think you make a mistake with the pasted code, you would probably do this :
error_num= port->write(byte);
cout<<"Number of bytes that were actually written: " << error_num <<"\n";
if_error=port->waitForBytesWritten (5000);
if (if_error)
cout<<"Data Sent\n";
else
{
cout<<"Error sending data: ";
port_error=port->lastError();
cout<< port_error <<"\n";
return a.exec();
}
error_num= port->write(byte);
cout<<"Number of bytes that were actually written: " << error_num <<"\n";
if_error=port->waitForBytesWritten (5000);
if (if_error)
cout<<"Data Sent\n";
else
{
cout<<"Error sending data: ";
port_error=port->lastError();
cout<< port_error <<"\n";
return a.exec();
}
To copy to clipboard, switch view to plain text mode
What string error do you have?
What is the result of the write(byte) call? If it is equal to your command length just call the waitForReadyRead(5000) in order to wait for the response "OK".
Bookmarks