Universal Robots Forum

Wait timeout on an input

As their is no option available in the Polyscope to have a timeout on an Input I’m trying to write a script to do the function
I’m struggling a little with syntax.
line 2 gives a syntax error when the program is run.
however when entered into the main program via Polyscope the syntax looks the same!

def Wait_Input_Timeout(DI_Num,Timeout):
timer_1: Reset
timer_1: Start
if get_standard_digital_input[DI_Num]== False:
wait timer_1 == Timeout
timer_1: Stop
return False
else:
return True

end

Create a loop condition for a timeout

Loop not (input or Timeout = 8)
wait 0.25
Timeout = Timeout +1