Hi, I have found several ways to carry out an action if an input is on for a certain amount of time.
I’m wondering if there is an easy way though, what methods do you use?
Thanks.
In a thread:
if(input_is_pressed) {
time_variable = time_variable + get_steptime()
if(time_variable >= my_threshold) {
do_something()
}
} else {
time_variable = 0
}
Probably something like that. You could leave the conditional processing somewhere else in the code as long as you define time_variable for global use.
I would do it like this, using UR commands. Or placed in a thread like Eric. Depends on your application.