Mar_60 last edited by
I have issues in using QSerial port. Actually, I have reading/writting data in my QT project using arduino. I have initialized my serial port in this way:
serialport = new QSerialPort(this); serialport->setPortName("COM3"); serialport->setBaudRate(QSerialPort::Baud19200); serialport->setDataBits(QSerialPort::Data8); serialport->setFlowControl(QSerialPort::NoFlowControl); serialport->setParity(QSerialPort::NoParity); serialport->setStopBits(QSerialPort::OneStop); qDebug()<<"Serial Port Opened"<<serialport->open(QSerialPort::ReadWrite);
After reading/writing data from arduino at desired time, I want to stop it.
I am stopping the serial port by using the command:
When I run my code for the first time, serial port doesn't stop. So, I stop my serial port forcefully through arduino's Serial Monitor. And then when I run my app again, it works alright. It start working perfectly 2nd time and ownwards. What I need to do, in order to close serial port in the first attempt.
Waiting for guidance
What do you mean exactly by "stop it" ?
In your code, you open
serialport, but you close
Might that be a problem?
Otherwise provide more code. From the snippet, its not obvious.