Universal Robots Forum

Rising and falling edge in Polyscope

# Summary

Ability to use rising and falling edge detection when programming in Polyscope.

# What is it?

The ability to check for a rising or falling edge, e.g. when using the expression editor.
It could be 2 extra butons in the expression edtior, which would make this really easy and accessible.

Something like this:
UR_EE

# Why is it needed?

It would give a bit more power and flexibility to Polyscope programming, without the need of a PLC.

I currently have a project where it would be so much easier to just have an event that checks for a rising edge on an input and then sets a single pulse on an output - once.

Event:
digital_in[1] REdge - set digital_out[1] for 500ms
(just as an explanation, I don’t know polyscope script)

Here’s a script that does what you’re asking. You can just change the input, output, and duration variables to whatever you need. I do agree, having them built in would sure be handy.

thread risingEdge():

input = 1
output = 1
outputDuration = 0.5

while(True):
while(not get_digital_in(input)):
sync()
end
set_digital_out(output, True)
sleep(outputDuration)
set_digital_out(output, False)
while(get_digital_in(input)):
sync()
end
end
end

thrd = run risingEdge()