最近项目需要串口操作,我想向串口发送连续16进制命令,如下:
myCom = new Win_QextSerialPort("com2",myComSetting,QextSerialBase::EventDriven);
//定义串口对象,并传递参数,在构造函数里对其进行初始化
myCom ->open(QIODevice::ReadWrite);
char lightinitia1[]={0x57,0x02,0xff,0x50};
char lightinitia2[]={0x57,0x03,0xab,0x50};
myCom ->write(lightinitia1);
myCom ->write(lightinitia2);
请问这样做对吗?卡了好久了!十分感谢!
