Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Link between 2 serial ports
goupil35 last edited by
I want to do a link between 2 serial ports (all coming in COM3 have to be resent to COM4 and the same in the other way).
I use the terminal version and in "main.cpp" I create another MainWindow variable w1. In "MainWindow.cpp" I was able in method MainWindow::ReadData() to modify so I can test what is the COM (the code is included below).
My problem is that when I do "serial->write(data);" it sends the data on the same COM that the bytes received. I want to send data received in the other one: if I get data on COM3 I want to send them on COM4 and vice-versa.
Have someone an idea ?
QByteArray data = serial->readAll();
Hi and welcome to devnet,
To make it simple, just use one MainWindow with two serial ports (use meaningful names for the variables) and one slot for each serial port (you can optimize that later)