Debounce Digital Inputs

Hello Everybody,

whats the best way to debounce digital inputs by Script Commands or on the UR Main View?

Thank you all and hava a nice Day :slight_smile:

Stefan

Not usually a big ladder guy, but I’ve been enjoying my own rendition of a T_on block. Something like this structure using timers:

# For rising edge debounce when waiting for a HIGH input
debounce_time = 0.1

timer.reset()
timer.start()

# If digital input goes low at any point, don't continue until it's been on for at least debounce_time
while(timer < debounce time):
    if digital_input = LOW:
       timer.reset()
    sync() # or sleep depending on polling requirements

You can set it up to debounce falling edge as well by changing it a little.