测试完成代码

This commit is contained in:
琉璃月光
2025-08-18 16:54:29 +08:00
commit a38051e4dc
194 changed files with 3570686 additions and 0 deletions

13
COM/testTCP.py Normal file
View File

@ -0,0 +1,13 @@
import sys
print(sys.executable)
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('192.168.0.123', port=502)
if client.connect():
print("🟢 Modbus 连接成功")
result = client.read_coils(0, 1, unit=1)
print("读取结果:", result)
else:
print("🔴 Modbus 连接失败")