LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting boolean indicator values in a cluster

Highlighted

Hi everyone,

 

I'm trying to set values of boolean indicators located inside a cluster control but for some reason, labview doesn't change the value of the specific control that I'm trying to set even though the code executes correctly. Instead, a different indicator changes. I created a reference of controls and I'm using property nodes to manipulate the boolean values.  After deleting the initial indicators and creating new ones, the new controls do not change at all when I try to set their values. Does anyone know what might be causing this? Please see attached code.

 

Thanks

0 Kudos
Message 1 of 7
(999 Views)

Your code is a bit convoluted, but you've written it such that if a boolean starts out TRUE, you write TRUE to it (so you see no change).  If all booleans start out FALSE, then you write FALSE to all booleans (and still see no change).

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

SoIPS,

 

Your code does exactly what it is programmed to do, just not what you want it to do...

 

Be careful when indexing through clusters, you might not have your controls in the order they appear visually. Right click on your cluster and select "Reorder Controls In Cluster..." and you will notice that switches b7 and b8 are lower index then switch b5 and b6.

 

Why not split the array of controls, get the values from the switches, then write to the displays. (You could do this all in the same For loop too)

 

values.png

0 Kudos
Message 3 of 7
(958 Views)

My question is "What are you really trying to do, and Why do it this way?".  It seems (to me) that at one level, you want to have a Boolean Array of Controls and know the State of each of them, allowing each to be changed by toggling the respective controls.  

 

Here's an example -- this is a 2D array of Boolean Controls that will "light up" if pressed.  The attached code runs until you turn all of the switches on.

Boolean Array FP.pngBoolean Array.png

 

 

 

 

 

 

 

 

Bob Schor

0 Kudos
Message 4 of 7
(924 Views)

Here's what I would probably do...

 

switchIt.png

Of course you could micromanage and add more code so only the changed indicator gets written, but it simply is not worth the effort. Note that I made the LEDs "disabled (not grayed)" so they act as indicators and cannot be operated even thought the cluster is a control.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 5 of 7
(918 Views)

Thanks everyone for all your suggestions. Yes, indexing out of the cluster was causing the problem because the controls were not in the correct order. I will take your suggestion and split the array of controls and then write to the indicators.

0 Kudos
Message 6 of 7
(900 Views)

Even simpler, you could just make an array of boolean switches where each state has a picture consisting of a checkbox next to an LED. Create one picture for TRUE and one for FALSE.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 7 of 7
(895 Views)