LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Event to handle 12x12 Array or Cluster UI

Solved!
Go to solution

I'm looking to handle up to a 12x12 array/cluster to enable different LEDs. The enable method will be two numeric controls, MxN, which will light LEDs in a specific order based on the MxN control data entered. The specific order is right to left, bottom to top. Right now, I have only a few states functional, but I have to account for every state as shown in my block diagram. I'm looking for some feedback on how to handle this dynamically. I am aware of the Register For Events, but lack the experience to understand if this is the route I should take. Thanks in advance to all who respond!  

Examples

2x2         3x3

4|3          9|8|7

2|1          6|5|4

               3|2|1

 FrontPanel1.jpg

BlockDiagram.jpg

0 Kudos
Message 1 of 7
(3,122 Views)

Couple of things that might help you out:

 

1) You can register for the same event of different controls - e.g. value change event / key-up just 'edit events handled by this case' and add the additional controls to the pane on the left - only certain types are compatible with each other. You can dynamically register for the events by creating a 'register for events' node and giving it a reference/array of references. You'll need to show the dynamic event terminal (right click on event structure) and don't forget to unregister for events afterwards.

 

2) You could create a 2D array of references of your booleans and then iterate through the array and/or index out specific booleans from the array, writing the value using a property node.

 

3) You can also do things like setting values of controls by label/name - you can read the label of a control using a property node and use the 'Set Value' VI method to write the new data.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(3,107 Views)
Solution
Accepted by topic author AdamB82

So only one LED can be active at any give time right? Use a boolean 2D array of LEDs, initialized at 12x12, then, using replace array subet, write a true to the LED at index MxN. Do this in a value changed event for the row or column controls. The code would probably fit on a postage stamp. No value proerty nodes or local variables needed.

 

(Next time, please attach your VI instead of oversized, truncated pictures that show very little of the story. Thanks.)

0 Kudos
Message 3 of 7
(3,096 Views)

You mention to initialize the 2d array to 12x12. From what I can tell there is no way to specify a max array size within the tool. Was the intent of this statement to display a 12x12 LED pattern and disable the index display?

0 Kudos
Message 4 of 7
(3,078 Views)

@AdamB82 wrote:

From what I can tell there is no way to specify a max array size within the tool.


What "tool"? Nothing you write makes any sense.

 

You can initialze an array of any size and you can define the number of visible rows and columns using property nodes.

 

Again, please attach your VI before we discuss this any further. Thanks.

0 Kudos
Message 5 of 7
(3,072 Views)

Tool == the LabVIEW software... semantic differences aside, I do understand what you mean by initialize now. When you said, "Use a boolean 2D array of LEDs, initialized at 12x12", I interpreted that as I should set a max number of elements to 12x12.

Thank you for your help developing this code.

0 Kudos
Message 6 of 7
(3,065 Views)

Why are you making the array a control?  Why not just make it an indicator so you don't have to use the local variable?

 

Also, make sure your stop button is actually in a Stop Button:Value Change event case.  You will not be able to stop your VI as is written.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,029 Views)