test mainloop

This commit is contained in:
Kseninia Mikhaylova 2024-08-23 10:21:04 +03:00
parent ae7234b6e5
commit 44d79b598d
4 changed files with 35 additions and 20 deletions

View File

@ -1,21 +1,17 @@
print("modbus test")
from func import *
# from func import set_user_reg_800
from pymodbus.client import ModbusTcpClient
import time
import glob
import tkinter as tk
client = ModbusTcpClient(
host=MODBUS_SERVER_HOST,
port=MODBUS_SERVER_PORT,
)
client.connect()
# максимальное количество coils = 286
from func import *
window = tk.Tk()
window.geometry('520x300')
label = tk.Label(window, text="Hello, world!")
label.pack()
# bulb(2)
# get_coordinates()
# get_or_set_speed(10)
all_files = glob.glob("data/data.txt")
file = all_files[0]
@ -30,10 +26,11 @@ with open(file, "r") as fp:
data.append(r)
# print(data)
def multiply_1000(n):
return int(n * 1000)
client = ModbusTcpClient(
host=MODBUS_SERVER_HOST,
port=MODBUS_SERVER_PORT,
)
client.connect()
GOTO_Y = 5
@ -113,5 +110,8 @@ try:
except Exception as e:
print("error", e)
client.close()
finally:
client.close()
if __name__=="__main__":
window.mainloop()

View File

@ -109,4 +109,7 @@ def start_in_auto(client):
def stop_immediately(client):
client.write_register(20004, 1, MODBUS_SLAVE_ID)
client.write_register(20004, 1, MODBUS_SLAVE_ID)
def multiply_1000(n):
return int(n * 1000)

15
poetry.lock generated
View File

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
[[package]]
name = "attrs"
@ -317,6 +317,17 @@ files = [
{file = "svgwrite-1.4.3.zip", hash = "sha256:a8fbdfd4443302a6619a7f76bc937fc683daf2628d9b737c891ec08b8ce524c3"},
]
[[package]]
name = "tk"
version = "0.1.0"
description = "TensorKit is a deep learning helper between Python and C++."
optional = false
python-versions = "*"
files = [
{file = "tk-0.1.0-py3-none-any.whl", hash = "sha256:703a69ff0d5ba2bd2f7440582ad10160e4a6561595d33457dc6caa79b9bf4930"},
{file = "tk-0.1.0.tar.gz", hash = "sha256:60bc8923d5d35f67f5c6bd93d4f0c49d2048114ec077768f959aef36d4ed97f8"},
]
[[package]]
name = "tomli"
version = "2.0.1"
@ -457,4 +468,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "2.0"
python-versions = "3.10.12"
content-hash = "c7d6bddfce25fa53e5a29e91975eacc36d85962e2d132e0f892a2fdfb956bbef"
content-hash = "a224728a18ef19c1f754e77db7d8cba413724a9a4257af5704b0fad93f833c58"

View File

@ -12,6 +12,7 @@ pymodbustcp = "^0.2.2"
pymodbus = "^3.7.0"
pymodbus3 = "^1.0.0"
svgpathtools = "^1.6.1"
tk = "^0.1.0"
[build-system]