Cannot output a value using QSerialPort
-
Hi
Some notes
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.Actually you can :)
must be before open!
All of them. Open goes last.You do not check if
arduino->open(QSerialPort::ReadOnly);
fails.
like
if ( ! arduino->open(QSerialPort::ReadOnly) ) {
QMessageBox::information(this,...report error);
return;
}
see @jsulm post !So does it ever enter into void Dialog::readSerial() ?
-
@mrjj said in Cannot output a value using QSerialPort:
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
I already said this some days ago: https://forum.qt.io/topic/112346/cannot-output-a-value-using-qserialport/23 but it is simply ignored...
-
@mrjj said in Cannot output a value using QSerialPort:
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
I already said this some days ago: https://forum.qt.io/topic/112346/cannot-output-a-value-using-qserialport/23 but it is simply ignored...
@Christian-Ehrlicher
Indeed and also @jsulm also noted to check open which seems to be forgotten also. -
@mrjj said in Cannot output a value using QSerialPort:
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
must be before open!This is not true. You can configure QSP in any time.
-
@mrjj said in Cannot output a value using QSerialPort:
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
must be before open!This is not true. You can configure QSP in any time.
-
@mrjj said in Cannot output a value using QSerialPort:
You call setBaudRate, setDataBits etc AFTER you open port. that is wrong.
must be before open!This is not true. You can configure QSP in any time.
@kuzulis said in Cannot output a value using QSerialPort:
This is not true. You can configure QSP in any time.
Are you saying that you can change the settings once a connection has been established?
-
@kuzulis said in Cannot output a value using QSerialPort:
This is not true. You can configure QSP in any time.
Are you saying that you can change the settings once a connection has been established?
@Pablo-J-Rogina
Yes seems so and he should know as he wrote it :)
-
@Pablo-J-Rogina said in Cannot output a value using QSerialPort:
Are you saying that you can change the settings once a connection has been established?
Of course, after open() you can do what you need.
-
@Pablo-J-Rogina said in Cannot output a value using QSerialPort:
Are you saying that you can change the settings once a connection has been established?
Of course, after open() you can do what you need.
@kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted? -
@Pablo-J-Rogina said in Cannot output a value using QSerialPort:
@kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted?The serial communication has no "connection" things. About what "connection" do you speak?
PS: In reality (on a low level), any device configurations always changes after a device has been opened! This belongs to any device.
-
@Pablo-J-Rogina said in Cannot output a value using QSerialPort:
@kuzulis but changing the settings once you open the port, does impact on the ongoing connection?
I mean, does the other side need to update the settings as well? And if so, won't the connection be interrupted?The serial communication has no "connection" things. About what "connection" do you speak?
PS: In reality (on a low level), any device configurations always changes after a device has been opened! This belongs to any device.
@kuzulis said in Cannot output a value using QSerialPort:
About what "connection" do you speak?
An ongoing transmission
-
@Pablo-J-Rogina said in Cannot output a value using QSerialPort:
An ongoing transmission
In this case an ongoing data stream just will be transferred with a new parameters (speed, parity ant etc).