QtSerialPort sending data
-
Hi and hello,
short problem. I try to send 3 commands with QtSerialPort to a device. If I send them in 3 different routines triggered by 3 buttons it works perfect. If I call these 3 routines from one additional routine it fails. The fourth routine includes the correct timing (sleep(2000)) on a windows system. A port sniffer shows the right commands, a break of 2000 ms from the first one to the second, but the third one comes together with the second one.
@
button1-click -> command1
button2-click -> command2
button3-click -> command3
@
the other way
@
button4-click -> command1 -> sleep(2000)->command2->sleep(2000)->command3
@
Why there is no break between command2 and command3 in the second way?Thanks,
Erni35 -
Please do not use sleep() call, because it is freeze event-loop.
Instead use QTimer with command interval 2000 msec to send.