LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Debouncing" an on screen button

 

Is there a way to limit how many times a user can press a control in a certain amount of time? I am not sure how else to describe it other than debouncing.  

 

 Basically I have a push button and a flaky mouse that is causing it to register several mouse clicks far enough apart that checking "Lock Panel.." or "limit max instances to 1" does not keep it from triggering multiple times.

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 8
(2,920 Views)

If you are using an Event structure, you should be able build a little logic into the "Value Changed" Case for the push-button.  For example, suppose it is Switch when Pushed, Switch when Released, or Switch while Pressed (I'm not sure those are the "official" names), you could put a 10 msec (or even 1 msec) "Wait" in the Case, which should handle any "Transition noise".  If it is a latching control, you might want to have a Frame Sequence where you wait first, then read (and reset) the Control (but may it wouldn't matter here ...).

 

Bob Schor

0 Kudos
Message 2 of 8
(2,901 Views)

I would replace the mouse. 😄

 

What is the mechanical action?

 

Note that each event data node has a time output which is identical to the tick count. Subtract the previous tick and check if at least 1000ms have elapsed to execute the real code, else execute an empty case.

 

(Lock front panel will not help. Same for max instances=1)

Message 3 of 8
(2,893 Views)

Here's what I had in mind (the purpose of the init is to ensure that the first click generates a false):

 

altenbach_0-1586207634282.png

 

0 Kudos
Message 4 of 8
(2,887 Views)

Why not replace the mouse?  This is by far the best solution by just about any measure.  I imagine replacing the mouse is a lot less expensive than you taking the time to think of and implement a software workaround to a hardware issue.  For example, just how long did it take for you to muck around with this before you came here?  How many solutions are you going to consider before trying a few out?  The engineering hours you put into this will probably far outstrip how much money you'll spend on a mouse.  Not to mention that replacing the mouse resolves the issue, while coding a workaround merely attempts to hide a problem.  It's like "fixing" a pothole by placing a detour sign over it.

 

If the mouse is really as bad as you say, how do they do ANYthing on that workstation?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 8
(2,863 Views)

Use the filter event, compare the time stamp, and discard if time threshold not reached.

0 Kudos
Message 6 of 8
(2,707 Views)

Wasn't hardware at all...

 

There were Property Nodes in other cases causing is to appear as double or even triple click.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 8
(2,697 Views)

How did you not find that earlier?  Was it buried somewhere in some kind of spaghetti code that wasn't made by you?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(2,664 Views)