相对于使用QT5的QSerialPort串口类需要各种麻烦,还是选中了QExtSerialPort.
qextserialport下载:http://sourceforge.net/projects/qextserialport/
需要使用到的文件:
windows平台下:qextserialbase.cpp,extserialbase.h,win_qextserialport.cpp,win_qextserialport.h
linux平台下:qextserialbase.cpp,extserialbase.h,posix_qextserialport.cpp,posix_qextserialport.h
在linux下使用时编译会出现错误。
直接将第一个参数Settings.Timeout_Sec删除即可
我是使用USB转TTL实现雷达和上位机串口通信的,基于我下面的测试代码,总是无法打开串口
报错如下:
Trying to open File
Could not open File! Error code : 5
1、检查系统是否支持usb转串口:
# lsmod | grep usbserial
如果有usbserial,说明系统支持USB转串口。
2、查看usb转串口、串口的安装状态
# dmesg | grep ttyUSB*
# dmesg | grep ttyS*
例如,