LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing LED color by refnum - good practice

Hello all,

 In a testing program I wrote, I have many boolean LEDs indicating Pass as GREEN when lit, and Fail by being not lit. I would like to have them indicate Fail by being lit RED. I realize I can do this with Property Nodes, but being as there's so many of them, I thought a better solution would be a little utility VI that takes a reference. See attached utility and tester.

 

Is this the best way to do this? Or are there unintended consequences of doing it this way? 

 

Thanks,

John W

Download All
0 Kudos
Message 1 of 8
(4,037 Views)

I think your code should work without causing problems.  I like this method, because it allows an unlit LED to signify that a test has not been run. If you really only want to show the two colors though, you don't need references: you can just change the false color of the LED to red.  Do this by right clicking on the LED, clicking on properties, then clicking on the "off" color and choosing red.

0 Kudos
Message 2 of 8
(4,032 Views)

Like you stated, I need to have the unlit color some dark off green or whatever, to signify that that particular test hasn't executed yet. Then, either green or red indicates it has run, and has either passed or failed.

John W

0 Kudos
Message 3 of 8
(4,018 Views)

I have made something similar but with a reset input to set the colot back to dark green. When this input is true it override the pass/fail input. When reset is false a true on the P/F input set the led color to bright green and a false to bright red.

 

Ben64

0 Kudos
Message 4 of 8
(4,011 Views)

You can also use a "Colorbox" indicator instead of a boolean indicator. Send a particular color for pass, fail, not yet tested, etc.

 

Cheers,

mcduff

0 Kudos
Message 5 of 8
(4,003 Views)

Thanks all!

 

@McDuff, This particular project was my 1st project in LV in 2011. I had never heard of that colorbox idea at that time. I'm just enhancing the code now and don't know if I want to re-do all the logic in there or not. I'll take a look at that aspect.

 

@Ben, that's an interesting idea as well. I might be able to use something like that, as now I'm using property nodes to "reset".

 

0 Kudos
Message 6 of 8
(3,988 Views)

I guess one of my reasons for posting was to ask if using boolean refnums is good practice, i.e. memory efficient; or not too slow; in general better than using property nodes to access front panel indicators?? 

 

Thanks,

John W.

 

 

0 Kudos
Message 7 of 8
(3,970 Views)

Booleen Refnums and property nodes are equivalent in terms of performance; just different ways of accessing the same thing.

 

Both however can cause a switch to the UI thread which in turn may make your program slower. If you are using them sparingly, that is, not in a tight loop, then you are probably okay. (I have not looked at your VIs as this computer does not have LabVIEW). A Knight of NI, altenbach, typically recommends colorboxes for your scenario, that is why I recommended them.

 

Cheers,

mcduff

0 Kudos
Message 8 of 8
(3,957 Views)