Unsolved How to change QSerialPort baud rate if device is connected?
-
Hello my device has option to change baudrate it always start with 9600.
I try:serialPort->write("commandtochangebaud"); serialPort->setBaudRate(QSerialPort::Baud19200);
I lost connection and device don't answer.
-
hi
so it sounds like
serialPort->write("commandtochangebaud");
dont make it change baud and when you switch to
Baud19200, they can no longer talk. -
But comand is from datasheet. Maybe I have to close and open again or change in windows Device manager->COM/LPT->baudrate
-
Hi,
Can you give more information about that device ?
-
Maybe you need to wait a bit between write() and setBaudRate(). You need to call the setBaudRate() only when the wtite() completes. e.g. it can be done after bytesWritten(qint64 bytes) signal + some delay with QTimer.