05-28-2007 11:17 AM
The event structure is definitely the way to go. Here are a few more tips:
05-28-2007 11:47 PM
@Mathias_P wrote:
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.
Always do remember that, when you want something to get executed only once on the click of a button, then you should use a push-button with a Latch mechanical action. Moreover, this button should directly be connected to the case structure that executes the code because its inherent nature is that it ll retreat to False state only after its state is read in the code.
See the Help for more details on the various mechanical actions of boolean controls. Boolean indicators & Radio button controls wont ve user-configurable mechanical actions.
05-29-2007 01:26 AM
Maybe this works better. It is switched when pressed.
Andries
05-29-2007 01:49 AM
Andries,
I don't see the "logic" of all that complicated boolean gymnastics just to make a "switch until released" boolean to act like a latch action boolean. This does not make any sense! If you simply hook the boolean button directly to the case structure and change the mechanical action to "latch when pressed" you get exactly the same result, but with much less code.
I would also suggest to place a small wait statement inside the loop.
I also don't understand why the [i] indicator "False" is inside the case structure. Since [i] always increments, it is misleading to not update it in some iterations and show a stale value instead. It probably belongs outside the case structure.
05-29-2007 03:34 AM