LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with led indicators project.

Solved!
Go to solution

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: 

screenshot.png

0 Kudos
Message 1 of 9
(1,623 Views)

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


  1. Because you enabled autoinding the arrays of references to FOR loop will only iterate 6 times. After that the case structure within isn't executed anymore!
  2. Who says so? You can enable autoindexing for While loop tunnels!
  3. Start from scratch and implement your task using one (1) while loop with one (1) event structure within… Then it becomes easy to react on all kind of user input! It also helps to work with array(s) instead of all those scalar frontpanel elements.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,600 Views)
Solution
Accepted by topic author Seiryuu90

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

0 Kudos
Message 3 of 9
(1,586 Views)

This is what happens if the for loop just becomes while.
Screenshot_1.png

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?

0 Kudos
Message 4 of 9
(1,552 Views)

@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?

0 Kudos
Message 5 of 9
(1,549 Views)

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)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(1,539 Views)

@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.    

0 Kudos
Message 7 of 9
(1,529 Views)

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. 

0 Kudos
Message 8 of 9
(1,528 Views)

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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(1,521 Views)