Hi,
is it possible to run a scheduled task every second in iX?
Scheduled task
Re: Scheduled task
There are a couple options for scheduling a task. The first doesn't require any scripting. You could add the Demo Controller as an additional controller, which has counters built into it. See screenshots 1 and 2. You can set the timer to a tag and give the tag an action to do something every time the value of the timer changes.
A second option involves scripting but doesn't require a second controller. You can instantiate a timer with an interval and have it execute code every time the timer event "clicks". See the sample code:
A second option involves scripting but doesn't require a second controller. You can instantiate a timer with an interval and have it execute code every time the timer event "clicks". See the sample code:
Code: Select all
//Tie the start of the timer to an event like screen open or tag value change
void Screen1_Opened(System.Object sender, System.EventArgs e)
{
m_Timer = new Timer();
m_Timer.Interval = 500;
m_Timer.Tick += doSomething;
m_Timer.Enabled = true;
}
void doSomething (object sender, EventArgs e)
{
//code to execute on each timer tick
}
- Attachments
-
- Screenshot2.png (126.23 KiB) Viewed 6653 times
-
- Screenshot1.png (170.72 KiB) Viewed 6653 times
Best Regards,
Kyle W. | Applications Engineer
Beijer Electronics, Inc.
Kyle W. | Applications Engineer
Beijer Electronics, Inc.