1 Star 0 Fork 0

parker/SerialRealTime

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mythread.cpp 750 Bytes
一键复制 编辑 原始数据 按行查看 历史
Paul Miailhe 提交于 2020-10-19 17:53 . First Version : Serial Real TIme
#include "mythread.h"
#include <QMutex>
#include <QDebug>
MyThread::MyThread()
{
message1.resize(5);
message1[0] = 0x5b;
message1[1] = 0xe4;
message1[2] = 0x00;
message1[3] = 0x00;
message1[4] = 0x5d;
message2.resize(5);
message2[0] = 0x5b;
message2[1] = 0xe4;
message2[2] = 0x00;
message2[3] = 0x01;
message2[4] = 0x5d;
}
void MyThread::run()
{
qDebug() << "Worker :" << QThread::currentThread() << Qt::endl;
for (int i = 0 ; i < 10 ; i++)
{
QMutex mutex;
mutex.lock();
if(this->stop) break;
mutex.unlock();
emit sendCommande(message1);
QThread::msleep(300);
emit sendCommande(message2);
QThread::msleep(300);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/suparker/SerialRealTime.git
git@gitee.com:suparker/SerialRealTime.git
suparker
SerialRealTime
SerialRealTime
main

搜索帮助