I\'m using LibSerial on Ubuntu to read and write data on serial port.
At the moment, I\'m able to write and receive strings over the serial port, but my code does no
I think you just need to use while( serial_port.rdbuf()->in_avail() > 0 ) as a condition for your last while loop. Then it'll read out all the available data (“answer”) and you can send the second command after that.
while( serial_port.rdbuf()->in_avail() > 0 )