LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use array index to change Boolean(LED) values for 64 LED's

I am reading in serial data for 64 bytes for 64 LED. I have converted the string into an array and can access each element and compare to see if it is 1(On) and then output it into the specific LED (This works). This however is long and huge. I want to use a for loop in which the index of the loop is the index of the array and do my comparison and spit it out to the specific LED. This will make my block diagram small and tidy instead of huge as mentioned before. I am having trouble however creating this. Can someone give me some advise?
Thank you in advance!
0 Kudos
Message 1 of 6
(4,979 Views)
Use a For loop with the iteration wired to an index array vi. Your array is also wired to the index array. For each iteration (0, 1, 2...) you will have access to that array element (0, 1, 2...) - which you can perform all the operations on before going to the next iteration/element.
Good luck with it, Doug
0 Kudos
Message 2 of 6
(4,979 Views)
I am not sure if you application allows you to use an array of LED's rather than 64 separate LED's. If you can use an LED array, you will not need a for-loop for turning on the LED's that needs to be turned on. You can have all 64 LED's in your array visible at the same time provided that you make them small enough. Hope this helps. /Mikael
0 Kudos
Message 3 of 6
(4,979 Views)
Here is an example of what I mean with a 64 LED array. /Mikael
0 Kudos
Message 4 of 6
(4,979 Views)
You might be able to do that without any for loop. Typecast the string directly to an array of boolean (non-zero elements will convert to TRUE) and assing it to a boolean array indicator. If you need 64 distinct boolean indicators, put them in a cluster and use "Array to Cluster" to convert the boolean array to a cluster. You have to set the cluster size of "Array to Cluster" node to 64 (pull down menu).

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 6
(4,979 Views)
If I understand your question, the attachet vi solves the task.
0 Kudos
Message 6 of 6
(4,979 Views)