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: 

Tri-Color LED Indicator

Solved!
Go to solution

I need to create a LED indicator that will indicate the Pass/Fail condition of a device.  Green if it has passed, red if it has failed and no light if there is no condition set yet.  The program will run some test and Pass/Fail the unit based on results of the tests.  As well as this the user needs to be able to fail the unit by pressing the LED.  I've created a program and attached it below.

 

The program works like I'd like it to but this is my first official LabVIEW VI and I was looking for some input/suggestions/comments or criticisms.  What I've come up with seems a little convoluted, is it? Or is there some control already built into LabVIEW that I missed.

 

Any input is appreciated.

 

Thanks,

 

Kevin 

0 Kudos
Message 1 of 5
(10,660 Views)
Solution
Accepted by topic author KevinO

Hmm, where to start... 😉

 

Congratulation to your first working program! Now it's time to get rid of 90% unecessary code and correct some beginner mistakes.

  1. It is unatural to have toggle switches as "latch action". Use buttons.
  2. Use only one loop. The lower loop spins as fast as the CPU allows, doing nothing most of the time while consuming all available CPU.
  3. All you need is a single event structure. It can handle all user events.
  4. Since you want 3 colors, use a colorbox made to look like an LED (howto). Now you don't need any property nodes at all.
  5. It feels also strange to create a mouse-down event on an indicator, but if that's what you want....
  6. I am not sure why you have the enum as a control, since you only use it as indicator.
  7. Your program is just peppered with local variables and value properties. You don't need any of those.
  8. Simplify!
  9. Simplify!
  10. Now it's easy to add more functionality.

 

Here's a quick draft. See if it makes sense. Modify as needed.

Message 2 of 5
(10,626 Views)

altenbach,

 

Thanks for the reply.  This is exactly the kind of input I was looking for.

 

Kevin

0 Kudos
Message 3 of 5
(10,561 Views)

Attached is my contribution for a  tri-state indicator.

It is a radio button with three overlapping buttons each having the off color as transparent.

Net result is:

0 = red (i.e. fail)

1 = green (i.e. pass)

2 = undecided bland dark color (default value)

I used the classic radio control because it is easy to hide the boundary by making transparent.

 

0 Kudos
Message 4 of 5
(5,249 Views)

I've done that too.

Here's something a little fancier.

 

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 5
(5,216 Views)