Showing results for 
Search instead for 
Did you mean: 

Turn on LED when measurement is made

Flat sequence is best way to turn on boolean led during measurement? Is there any better solution for this?

0 Kudos
Message 1 of 5

Use a shift register to store a boolean that indicates if the measurement on or off. Read the shift register once in the while loop and connect it to an indicator. Change the value of the boolean shift register as you wish.


Generally, you do not need any sequence structures or local variables and I would advise not to use them. It is clumsy and although it may not be an issue here, your programming style makes your code prone to race conditions. Think dataflow!


Also, do not put wait functions inside the Event structure. All code in Event structures should execute immediately so the UI is responsive to user interactions.

0 Kudos
Message 2 of 5

Ok. I make 3 version. I think best version is without shift register. Is this good solution for indicates when measurement is on or off?

0 Kudos
Message 3 of 5

Anyone can confirm? Ver2 without shift register is ok?

0 Kudos
Message 4 of 5

It is ok, if it fulfill its purpose.

But if you would like to improve your code, follow perhult's advices. Also you could use clusters and type definitions to make your code easier to read and modify.

A good code should be easy to read. This is important, if you plan to work more with LabVIEW and create more complex applications in future.

0 Kudos
Message 5 of 5