12-08-2009 01:23 PM
As part of a bigger project, I'm trying to create a sub-VI which will allow me to move a "cursor" in a 3x3 array.
There should be 2 boolean inputs, one for moving down in the array, and the other for moving to the right. Once the edge of the array has been reached, the "cursor" will start back from the beginning.
I have a vague idea of a 2 dimensional array with LED's. Once "down" has been pressed, the LED corresponding to (0,0) will turn off, turning (0,1) on. Same goes for the "right" button. When "down" is pressed at (0,2), the LED should turn off, and LED (0,0) should turn on.
I'm sure it has something to do with initializing arrays, but i can't seem to find the right way to do it.
Any kind of assistance is much appreciated. Thanks!
Solved! Go to Solution.
12-08-2009 03:55 PM
It might help if you posted what you have tried so far.
I would probably use a shift register for the row index and another for the column index. Increment or decrement the index values when the buttons are pushed. Use the Quotient and Remainder function (divide by 3) to limit the index values to the {0, 1, 2} set.
Lynn
12-09-2009 06:52 AM
Maybe this will help.
Oh, I just noticed that I could have done the "Clear True" outside of the inner case structure and some other things too, but oh well - it works.
12-09-2009 09:46 AM
12-09-2009 01:12 PM
I believe that members should post their real work before any help is done since these members will only depend on others(solving a project while creating another and a major problem [not knowing LabView])
These members are my classmates which I respect although some have cursed me with 1337-speech ; they should atleast think before consulting others.
In this project ,there is alot of competition which this project will be included on the C.V. Resumee,if experts help some sophomore students who have not postedtheir work this will cause an inequality and a fierce and unbalanced competition.
Please report any of those cheaters so that some actions can be taken.
Thanks
12-09-2009 01:20 PM
I would just like to say that I wasn't asking for a solution to my homework, however, I was only asking about boolean arrays (which is a very small part of my project).
The thing is that I have reached a point where I cannot find anything wrong in my VI, yet it doesn't work properly, and so I will post what i have done so far so that anyone willing to help may TELL ME what I am doing WRONG, and not solve the homework for me.
I have posted the VI below, and if anyone can try to run it, and see why the LED's don't turn off after an increment, so that i may know how to solve not only this assignment, but others to come.
I would also like to clarify the fact that I am NOT cheating, and I am in NO WAY plagiarizing anyone's work. This is my own design, and everyone can see that is very amateurish, but it was the best I could come up with.
Thank you.
12-09-2009 01:26 PM
Your array is always empty. Look at the detailed help page for the Replace Array Subset function. It states that the function has no effect if the specified index refers to a location outside the array.
What you see on the panel is only a display and has nothing to do with what is in the array.
Lynn
12-09-2009 01:42 PM
I just read the help file and found an example on Arrays.
It's working now, but i still need to solve the flickering of the light.
Thanks anyway! Much appreciated.
12-09-2009 01:48 PM
You should put a short delay in the while loop to prevent it from hogging all the CPU resources. You may also have a race condition with the local variables. Use shift registers.
You also do not need the sequence structures.
One or both of those may contribute to the flickering.
Lynn