mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-10 01:05:42 +00:00
34 lines
653 B
Python
34 lines
653 B
Python
|
|
||
|
# 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()
|
||
|
|
||
|
#---------------------------------------------------------------
|