What does db mean?

I was studying a script taken from a ladder model and came across a db. what is it, and why does it take the value FALSE at the beginning?
image

debounce

1 Like

Basically it’s just a quick way to make sure the function won’t run again if it’s already running.

When something touches it, it’s going to do something that takes time. And in that time something could end up touching it again causing the code to run again and break things. So a quick solution is to create a variable that acts as a “debounce” that will be set to true while the function is running. So now when something else touches it, it knows that it’s already being processed and won’t run the code again.

As for why it takes false. It technically doesn’t need to. It could be true instead as it only matters to let the function know the code is already running. It’s just false here because that makes more sense to the scripter.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.