资源简介
使用python开发的一个串口上位机应用,主要使用的工具包有pyside2、PyQtgraphy、pyserial。程序入口文件为data_app.py
代码片段和文件信息
# encoding: utf-8
import sys
import serial
import serial.tools.list_ports
from PySide2.QtCore import QTimer QTime QRegExp
from PySide2.QtGui import QIcon QRegExpValidator
from PySide2.QtWidgets import QWidget QApplication QMainWindow QMessageBox
import pyqtgraph as pg
from data_deal import Data_Deal
from MainWindow import Ui_MainWindow
class Data_App(QWidget Ui_MainWindow):
def __init__(self):
super().__init__()
# 创建串口实例对象
self.serial = serial.Serial()
# 创建 QTimer 实例对象
self.timer1 = QTimer()
self.timer2 = QTimer()
self.time = QTime()
self.now_time = ‘‘
# 创建显示窗口
self.main_window = QMainWindow()
self.setupUi(self.main_window)
self.retranslateUi(self.main_window)
# 正则表达式相关
bit_3_validator = QRegExpValidator()
bit_3_validator.setRegExp(QRegExp(‘[0-9]{13}‘))
self.fresh_waste_edit.setValidator(bit_3_validator)
self.fresh_edit.setValidator(bit_3_validator)
self.waste_edit.setValidator(bit_3_validator)
self.blood_edit.setValidator(bit_3_validator)
self.ultrafiltration_edit.setValidator(bit_3_validator)
self.debug_send_edit.setValidator(bit_3_validator)
# 储存所有存在的串口 字典
self.Com_Dict = {}
# 创建新csv文件标志
self.create_file_flag = True
self.write_data_flag = False
# 要保存的当前的文件名
self.now_file_name = None
# 串口接收的字符串
self.received_bit_data = None
self.received_data = None
# 图像对象
self.fresh_pressure_plot = None
self.waste_pressure_plot = None
self.fresh_flow_plot = None
self.waste_flow_plot = None
self.blood_flow_plot = None
self.artery_pressure_plot = None
self.vein_pressure_plot = None
self.weight_1_plot = None
self.weight_2_plot = None
self.weight_3_plot = None
self.tmp_plot = None
# self.ph_plot = None
# self.temperature_plot = None
# 保存收到的数据 list
self.x = 0
self.list_fresh_pressure = [0] * 10
self.list_waste_pressure = [0] * 10
self.list_fresh_flow = [0]*10
self.list_waste_flow = [0]*10
self.list_blood_flow = [0]*10
self.list_artery_pressure = [0]*10
self.list_vein_pressure = [0]*10
self.list_weight_1 = [0]*10
self.list_weight_2 = [0]*10
self.list_weight_3 = [0]*10
self.list_tmp = [0]*10
# self.list_ph = [0]*1000
# 接收到的最新的数据
self.flag = ““
self.fresh_pressure_data = 0
self.waste_pressure_data = 0
self.fresh_flow_data = 0
self.waste_flow_data = 0
self.blood_flow_data = 0
self.artery_pressure_data = 0
self.vein_pressure_data = 0
self.weight_1_data = 0
self.weight_2_data = 0
self.weight_3_data = 0
# 跨膜压
self.tmp_data = 0
self.initial_temperature_data = 0
self.proc
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 29531 2020-07-29 16:34 serial-python\data_app.py
文件 4709 2020-07-22 17:15 serial-python\data_deal.py
文件 37393 2020-07-14 15:24 serial-python\MainWindow.py
文件 42366 2020-07-10 16:55 serial-python\MainWindow.ui
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论