Your idea goes like this (pythr will be in next version):
Code:
#OnInit
print('OnInit')
pythr('Python\posmon.py')
#OnShutdown
print('OnShutdown')
_posmonstop=1
Code:
import sys
import time
import datetime
import threading
import planetcnc
print("|!|bposmon module BEGIN", str(datetime.datetime.now()))
planetcnc.setParam("_posmonstop", 0)
cnt = 0
while True:
if planetcnc.getParam("_posmonstop"):
break
x = planetcnc.getParam("_hw_motor_x")
y = planetcnc.getParam("_hw_motor_y")
z = planetcnc.getParam("_hw_motor_z")
planetcnc.print("Time PC: ", str(datetime.datetime.now()), " cnt: ", cnt, " Position X: ", x, " Y: ", y, " Z: ", z)
print("Time PY:", str(datetime.datetime.now()), "cnt:", cnt, "Position X:", x, "Y:", y, "Z:", z)
time.sleep(1)
cnt = cnt + 1
#if cnt > 5:
# break
print("|!|bposmon module END")