03-29-2023 08:16 PM
Hi,
I am kinda new to the labview thing and I am trying to create a project as follows:
I have a series of just led indicators like pixels of a screen and I want to turn on a random column at a time (or two), starting from top indicator to bottom one for half a second each one, inside a loop structure.
I have a screenshot posted as well as my .vi project for you to see. I have only made it to 2 columns thus far but there are some problems.
Those are:
1) Why does the case structure stop reading the case selector after the first loop? How to solve this?
2) Why am I not allowed to auto-index the arrays on a while loop, since that would help me with my project? When I do while loop an error appears.
3) I want the last row (not column) of the indicators to be controlled with two buttons preferably keyboard bindings. Those two buttons would be the left arrow and right arrow of the keyboard, that will "move" the true indicator to its respective one. For example if, the middle boolean is on and I press "right" then that indicator will turn off and the right one would turn on. How would you do that?
Any help is appreciated!
Screenshot:
Solved! Go to Solution.
03-30-2023 12:54 AM - edited 03-30-2023 12:56 AM
Hi Seiryuu,
@Seiryuu90 wrote:
1) Why does the case structure stop reading the case selector after the first loop? How to solve this?
2) Why am I not allowed to auto-index the arrays on a while loop, since that would help me with my project? When I do while loop an error appears.
3) I want the last row (not column) of the indicators to be controlled with two buttons preferably keyboard bindings. Those two buttons would be the left arrow and right arrow of the keyboard, that will "move" the true indicator to its respective one. For example if, the middle boolean is on and I press "right" then that indicator will turn off and the right one would turn on. How would you do that
03-30-2023 07:57 AM
Some ideas:
You could put use one LED and create a two-dimensional array of LEDs out of it so you don't have to deal with many single booleans; the array is one element and it could easily be extended to have more rows and columns. The array can be initialized at start to show a specific pattern.
You could then also light up an entire row or column at once by replacing array elements with constants.
Looking at the given number of row being 8, you would create and initialize a boolean array constant to all TRUE and replace, let's say, column 3
03-30-2023 08:58 PM - edited 03-30-2023 09:08 PM
This is what happens if the for loop just becomes while.
I feel like there is a simpler way to just light up each led one by one in each column preferably randomly. Can you help me?
03-30-2023 09:06 PM - edited 03-30-2023 09:07 PM
@MaSta wrote:
Some ideas:
You could put use one LED and create a two-dimensional array of LEDs out of it so you don't have to deal with many single booleans; the array is one element and it could easily be extended to have more rows and columns. The array can be initialized at start to show a specific pattern.
You could then also light up an entire row or column at once by replacing array elements with constants.
Looking at the given number of row being 8, you would create and initialize a boolean array constant to all TRUE and replace, let's say, column 3
Thank you for your idea but what if I want to display a RANDOM column at a time inside a loop structure and each element of the column light up one by one. For example the top element of the first column then off while the second one gets true then off, etc. How would I do that?
03-31-2023 12:34 AM
Hi Seiryuu,
@Seiryuu90 wrote:
I feel like there is a simpler way to just light up each led one by one in each column preferably randomly.
Surely there is a simpler way - and it already has been mentioned!
Setup an array of booleans, so you only need to handle one data object instead of 20+…
Then keep the data in a shift register so you don't need any property nodes to access the data!
@Seiryuu90 wrote:
This is what happens if the for loop just becomes while.
Because you don't read our messages: DON'T AUTOINDEX THE REFERENCES ARRAY AT THE (OUTER) LOOP BORDER!
(I hope the message is clear… :D)
03-31-2023 03:32 AM
@Seiryuu90 wrote:Thank you for your idea but what if I want to display a RANDOM column at a time inside a loop structure and each element of the column light up one by one. For example the top element of the first column then off while the second one gets true then off, etc. How would I do that?
The LED array displays what you feed. You could put a vertical or horizontal pattern for the specific row or column into the array, but you could also auto-index the array by row and/or by column (if both, then nested FOR loop) and set the single indexed array element to TRUE. In order to display letters and symbols, writing code that sort of can generate the array content dynamically to make the particular LEDs light up is way too effortive. You would most likely rather end up creating constants for every letter/symbol that you would load into the array. The constant data, on the other hand, could also be easily generated from a 6x7 LED array as controls where you click single LEDs to create a dot matrix letter/symbol and store the read array content as constant.
03-31-2023 03:35 AM - edited 03-31-2023 03:35 AM
Another hint: when you have two arrays with different size and both are auto-indexed on a WHILE or FOR loop, the loop will use the bigger one and thus, at some point, cannot index a valid reference anymore for the smaller one.
03-31-2023 03:50 AM
Hi MaSta,
@MaSta wrote:
when you have two arrays with different size and both are auto-indexed on a … FOR loop, the loop will use the bigger one
This is wrong!