LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

run once when click on button

Hello!

I have a question that is probably very obvious but I cant think of a good way to do it:

I want to have a LV-programme running continously and perform a measurement every time someone clicks a button. Then it should be idle and wait for the next mouse click to perform the same thing.

Thanks,

Mathias
0 Kudos
Message 1 of 15
(4,961 Views)
Hi,
 
I think the best and most simple way is to use a 'case structure'.
 
Andries
0 Kudos
Message 2 of 15
(4,949 Views)
Thanks for your reply Andries,

I was going for the case structure, but I ran in to problems when it came to turning the logic off after doing a measurement so that it does not keep measuring several times.

So how would one turn the case into false after measuring?

I attach my VI so you can see the case structure I have right now with a start button.


0 Kudos
Message 3 of 15
(4,943 Views)
Hi!

You can use Local Variable on RT or Property Node/Local Variable on Host.

Have a nice day!
0 Kudos
Message 4 of 15
(4,939 Views)
 

Then it should be idle and wait for the next mouse click to perform the same thing.


Using Event Structure is the way to go!    See here and here to start using events

0 Kudos
Message 5 of 15
(4,939 Views)
Look at attached vi
0 Kudos
Message 6 of 15
(4,935 Views)
That looks very handy, I only have the basic package of LV unfortunately, so I am not sure I can use the event structure in a proper way.

I will see if I can use yours  Smiley Wink

Message Edited by Mathias_P on 05-28-2007 04:36 AM

0 Kudos
Message 7 of 15
(4,933 Views)
Hi,
 
If you can not use event structures...
try this the vi I attached.
Its with a case structure. The record button is modified (in properties).
 
Andries
0 Kudos
Message 8 of 15
(4,925 Views)
I got it to work with the event structure, thanks for the suggestions

Message Edited by Mathias_P on 05-28-2007 05:47 AM

0 Kudos
Message 9 of 15
(4,917 Views)

Note: Events would be a better option since you mentioned an 'idle state' for your vi

Connecting '-1' ( default) to timeout terminal, shall make your vi wait for an event and your while loop shall not iterate during absence of event

Message 10 of 15
(4,909 Views)