LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

when my Discard button is clicked (ON) it stays at ON state for 30 seconds then goes back to OFF;

Solved!
Go to solution

Hello,
I want when my Discard button is clicked(on) it stays on for 30 seconds then goes back to off;
How can I do this please?

Thanks you

0 Kudos
Message 1 of 9
(1,653 Views)

So currently, it does not do that, right? A latch action button resets when the terminal is read by the code, so you could place the terminal into the timeout case and enable a 30s timeout when clicked.

 

Of course any other event will also reset the timeout, so you need to work around that.

0 Kudos
Message 2 of 9
(1,635 Views)
Solution
Accepted by Steph_2

Here's a quick draft doing 5 seconds (easier to test).

 

(Of course a real solution would be more scalable if there are other events.)

Message 3 of 9
(1,629 Views)

At this point, we might want to be asking "why" because there might be a better solution than this approach.

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 4 of 9
(1,618 Views)

@billko wrote:

At this point, we might want to be asking "why" because there might be a better solution than this approach.


Of course there is!

 

Once we have the full picture, more and better code will be needed. Maybe latch action is not even the right setting. For example what else should be allowed or not allowed during these 30 seconds (a very long time for a computer!!!!). etc

 

0 Kudos
Message 5 of 9
(1,613 Views)

Hi @altenbach,

Thanks for your reply.
But setting the rimout to 1 like that isn't going to help me, I've got a lot more events.
I've thought of a solution using your example but I haven't found one yet.
Thank you again.
0 Kudos
Message 6 of 9
(1,599 Views)

LabVIEW is a rich programming language, so everything is possible once you define all requirements.

 

  • What should happen if the button is pressed once more during the 30 seconds?
  • What is the purpose of all this?
  • What can and cannot happen during the 30 seconds?
  • Etc....
0 Kudos
Message 7 of 9
(1,588 Views)

Hi @ altenbach,

1. If you press the button again, it remains ON for 30 seconds and then returns to OFF (it won't change, it's the same).

 

2. The goal: I actually have a plugin that notes the value of the button in a csv file when the user presses the Discard button.

The Discard button indicates that the session is false and so it must remain pressed after 30 seconds because it cannot remain ON throughout the scenario. It is used for an annotation.

3. A 30 second delay has been set to allow the logger to write to the annotation file.

If I set the button to latch mechanical, for example, I won't be able to see in the annotation file that the Discard button has been pressed because it's very fast. the logger won't have the time.

0 Kudos
Message 8 of 9
(1,580 Views)

Nothing you explain makes much sense.

 

  • If you press again, should it count the time from the original press, or from the latest?
  • Is the button state read anywhere else?
  • Why not have a LED to show if the session is false?
  • The button is already latch action and the press cannot be missed.
  • ...
0 Kudos
Message 9 of 9
(1,573 Views)