LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How I can manipulate a 2D array of leds so that the LEDs light up in different ways ?

Solved!
Go to solution

Hi everyone, 

I have tried to understand Altenbach code but it is too hard for me, so I tried to do by myself. However this is what I get.

 

Should I add another for loop and a replace array?

 

 

0 Kudos
Message 11 of 16
(1,874 Views)

@TWRLK wrote:

Should I add another for loop and a replace array?

 


What is the purpose of the local variable? All you need is place the terminal in its place.

 

The result of your subtraction is sometimes a negative number.  Since there are no elements with negative indices, you won't get anything useful when that happens. Right?

 

Why are you wiring above the right inner shift register (creating a new tunnel) instead of across it?

0 Kudos
Message 12 of 16
(1,860 Views)

I corrected my code and it finally works.!!

 

Can you check it and tell me if I can improve it?

 

 

0 Kudos
Message 13 of 16
(1,808 Views)
Solution
Accepted by topic author TWRLK

@TWRLK wrote:

Can you check it and tell me if I can improve it?


You have way too much duplicate code. All your inner loops can be combined into one. All that differs are a few integer math parts and only these would go into a small inner case structure with four cases. There is also no need for local variables.

 

What's the point of all the hidden wires? Just to confuse the observer? Eliminate them. All you needs ot to wire out from the right-shift register. No need for a seperate output tunnel per loop.

 

Your diagram constants should be blue, not orange. Do you know why?

 

As mentioned, you should make the code scalable. Your diagram constants can be derived from the array size, so the code can adapt no matter what the size of the square input array is.

0 Kudos
Message 14 of 16
(1,803 Views)

Ok thanks for your advice, I will change my code...No, I do not know what is the difference between blue and orange variables. Can you tell me? 

0 Kudos
Message 15 of 16
(1,792 Views)

@TWRLK wrote:

Ok thanks for your advice, I will change my code...No, I do not know what is the difference between blue and orange variables. Can you tell me? 


it's the datatype. Blue wires are integers. You would right-click the diagram constant and select represetation...I32.

 

Also note that your math is incorrect. Sometimes toy are accessing the same element twice in a row. For example after replacing the top four elements, you only need to replace 3 elements going down, three elements going left, and two elements going up. etc.

0 Kudos
Message 16 of 16
(1,783 Views)