From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
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
(2,586 Views)

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
(2,557 Views)

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
(2,508 Views)

Anyone can confirm? Ver2 without shift register is ok?

0 Kudos
Message 4 of 5
(2,490 Views)

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
(2,463 Views)