Ai
1 Star 4 Fork 0

TRG PE/scratch-detect

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
restart.py 755 Bytes
一键复制 编辑 原始数据 按行查看 历史
Alex_Kwan 提交于 2025-04-22 17:39 +08:00 . 增加NG判定条件20250422
import time
import modbus_rtu
import os
import sys
import serial
ser2 = serial.Serial('com9', 38400, 8, 'N', 1, 0.3)
class restart():
def __init__(self):
super(restart, self).__init__()
def read_sensor(self): ### 检查触发开关
global ser2
# modbus_rtu model ↓----------------------------------
if not ser2 is None:
sensor = modbus_rtu.writedata(ser2, '01 02 00 00 00 01 B9 CA')
if sensor == '010201016048':
os.system("start cmd.exe /K autorun_main.bat")
ser2.close()
sys.exit()
else:
ser2.close()
sys.exit()
if __name__ == "__main__":
restarts = restart()
restarts.read_sensor()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/trgtokai/scratch-detect.git
git@gitee.com:trgtokai/scratch-detect.git
trgtokai
scratch-detect
scratch-detect
master

搜索帮助