当前位置:网站首页>QT weekly skills (3)~~~~~~~~~ serial port addition
QT weekly skills (3)~~~~~~~~~ serial port addition
2022-07-30 07:19:00 【transparent light】
前言
上次写了Qaction的添加,Make the interface look better,This time, add the serial port settings required by the project,This part is actually more like a gourd,别人怎么做,Just do it yourself.
第一节
Directly on the finished picture to see the effect,Continue below if necessary.
初始界面:

Click on the setting interface:

screen after connection:

点击下载后,The virtual serial port receives the data interface:

第二节
add points:
(1)Serial port element added;
(2)Serial port setting interface added;
(3)全局变量添加;
下面大概说一下:
串口:Serial port requiredclass已经包含在QT的库里面,所以可以直接调用函数.
添加位置:(1)profile to add the core file;
(2)mainwindowThe header file adds the serial port header file;串口类,分别为:
#include <QSerialPort>
QSerialPort *m_serial = nullptr;
(3)mainwindowThe main file adds class files,分别为:
m_serial(new QSerialPort)
串口设置界面:The serial port setting interface needs to be addedui工程,How to add this is described earlier.
添加位置:(1)mainwindowThe header file adds the serial port header file;分别为:
class serialset;
serialset *m_serialset = nullptr;
(2)mainwindowThe main file adds class files,分别为:
m_serialset(new serialset)
全局变量:Global variables are used in the same way as microcontrollers,After adding the correspondingclass删掉就行,然后在需要调用的A header file that contains global variables in the file will do.这样全部的A file can use a variable.Although in object-oriented programmingGlobal variables are discouraged,但是Don't stick to your frame,Most of the small partners should come from logic programming,You should be used to using global variables,Just remember where to change the parameters when you use it yourself.
结语
The following article will add a lot of serial port data processing and bit by bitcan数据处理方法,And use a simple screen to achieve.The program in the Baidu network disk is only the first time I have written itQTinterface is implemented,It's still a little bit bad now,So slowly improve the previous program,At the same time, add the problem of testing the number of serial ports received,For source code programs, please pay attention to the subscription number,Added Baidu network disk connection to the corresponding article in the subscription account,可以直接下载源代码.

The file cannot be sent due to the subscription number,So if you need source code, please leave a message.At the same time, the subscription account cannot send messages to the following friends first,You can only reply to the messages sent by your friends first,So friends who need source code, please leave a message in the public account.
边栏推荐
- 超详细的PCB高可靠辨别方法
- Application of remote sensing, GIS and GPS technology in hydrology, meteorology, disaster, ecology, environment and health
- QT每周技巧(2)~~~~~~~~~界面按钮
- 【正点原子】IIC的学习与使用(未完...)
- 无法完成包的安装npm ERR! Refusing to install package with name “moment“ under a package also called “moment“
- 如何开发出成功的硬件产品,一个产品由概念的产生到产品的落地量产又需要经历哪些流程呢?
- 闭包和作用域(你不知道的JS自用笔记)
- TCP建立连接的过程
- openssl 1.1.1编译语句
- QT serial 3: LORA test platform based on QT and STM32H750 (2)
猜你喜欢

MindSpore 提 PR 全流程

边境的悍匪—机器学习实战:第十三章 使用TensorFlow加载和预处理数据

【速成MSP430f149】电赛期间学习MSP430f149笔记

迪文串口屏幕制作(连载一)=====准备工作

Antd 树拖拽一些细节,官网没有,摸坑篇

"R Language + Remote Sensing" Comprehensive Evaluation Method of Water Environment
![[Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]](/img/f8/3eabe8833caec0be25aefb72f9c86e.png)
[Jiangsu University Self-Chemistry Association stm32F103c8t6] Notes [Introduction to 32 MCUs and Using TIM Output to Compare and Configure PWM]

QT Weekly Skills (1) ~~~~~~~~~ Running Icon

QT serial 4: LORA test platform based on QT and STM32H750 (3)

TCP为什么要三次握手,握手过程中丢包会怎么样?
随机推荐
QT每周技巧(2)~~~~~~~~~界面按钮
Three working modes of CPU: real mode, protected mode, long mode
clinit方法
Kunlun state screen production (serial 3) - based article (button serial port to send)
Massive remote sensing data processing and application of GEE cloud computing technology [basic, advanced]
PCB 一分钟科普之你真的懂多层板吗?
jvm之方法区
vs编译boost库脚本
干货 | 什么是FOC?一文带你看BLDC电机驱动芯片及解决方案
关于map对key自定义排序
i++与 ++i 的区别
FPGA解析B码----连载1
DeepLearing4j's deep learning Yolo Tiny realizes target detection
ssh 脚本 空格字符转换
如何判断 PCB 板是否变形?
工程师必看:常见的PCB检测方法有哪些?
SSH-RSA密钥
联影医疗二面
主机和从机配置,建立ssh连接实现Rviz远程控制
昆仑通态屏幕制作(连载5)---基础篇(串口接收,文本与灯显示)