mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
33 lines
653 B
Python
Executable file
33 lines
653 B
Python
Executable file
|
|
# The non-GUI variant of the PEV side
|
|
|
|
import time
|
|
import pyPlcWorker
|
|
from pyPlcModes import *
|
|
import sys # for argv
|
|
|
|
def cbAddToTrace(s):
|
|
print(s)
|
|
|
|
def cbShowStatus(s, selection=""):
|
|
pass
|
|
|
|
myMode = C_PEV_MODE
|
|
|
|
isSimulationMode=0
|
|
if (len(sys.argv) > 1):
|
|
if (sys.argv[1] == "S"):
|
|
isSimulationMode=1
|
|
|
|
print("starting in PEV_MODE")
|
|
print("press Ctrl-C to exit")
|
|
|
|
worker=pyPlcWorker.pyPlcWorker(cbAddToTrace, cbShowStatus, myMode, isSimulationMode)
|
|
|
|
nMainloops=0
|
|
while (1):
|
|
time.sleep(.03) # 'do some calculation'
|
|
nMainloops+=1
|
|
worker.mainfunction()
|
|
|
|
#---------------------------------------------------------------
|