Twincat3 TE2000 HMI Howto call a cyclic script

458 views Asked by At

quick question: is it possible to run a cylic function (eg every second) in the new TE2000 HMI? If so, how can I do so?

2

There are 2 answers

2
Roald On BEST ANSWER

You can use the JavaScript method setInterval.

setInterval(logTwinCat, 1000);

function logTwinCat() {
  console.log("Hi TwinCAT!")
}

0
Matej Bosnjak On

I hope it's not too late for the answer. The code is as mentioned above.. And for the Event call you need to go to TwinCAT HMI Configuration window and from there go to Global Events and click edit on onInitialized event call. Here you can add JavaScript call and copy paste code that Roland gave. Hope this answers your question.

setInterval(logTwinCat, 1000);

function logTwinCat() {
  console.log("Hi TwinCAT!")
}