07-01-2020 03:55 PM
I've been working on a program for a while, and I'm new to LabVIEW, so it's been difficult so far. I'm trying to control an array of a dozen or so servo motors (which would function as switches with one "on" position and one "off" position) using one LabVIEW switchboard. I've made the boolean array of T/F values, and I planned to use a list of old values and new values, comparing the two to determine whether to direct the servos to change position or not. However, I'm struggling to develop a way to generate and store those lists. My question is: how can I create those two lists and compare them, in an event structure for example, to allow for real-time management of servo position? Is this even a preferable way to accomplish this? I'd google this whole issue but I'm not sure how I'd phrase the search.
The picture I've attached is of my front panel, to try and given a better idea of the format I'm going for. I have all the code and can post whatever would be most helpful. I really appreciate anyone who can give guidance!
07-01-2020 11:37 PM
If the goal is to find out which of the "Array" values was changed (the boolean switches) then you can use something like this:
As the comment here says, it will return -1 when the array size increases, which isn't so helpful. So probably you'd want to make sure your array had all its values before you started checking (or make some inference from the array size changing and returning -1, since you know if this event fires then some value must have changed).
You can use the Index returned to Index Array over your "Shutter cluster array" if that's what you'd next need.
If you need the opposite workflow (changing "Shutter cluster array", then doing something about "Array") you can do something similar, although you'd probably want to then compare within the changed element to find out which part changed?
An example can be seen here: https://forums.ni.com/t5/LabVIEW/Event-structure-to-detect-value-change-of-a-control-within-a/m-p/83...
Let me know if I got completely the wrong goal/objective...
07-01-2020 11:40 PM
Note since you mentioned an Event Structure, I used one, but if you're working on an actual "Real-Time" system (as opposed to just wanting to do this responsively as things change, on a desktop system or similar) then you won't be able to use Value Change events in an Event Structure in most cases.
Then you'd want to do some sort of polling loop probably, but the same logic could be used (perhaps with a Feedback node to get the "OldVal").
Is Value Changed.vim (from 2017 onwards) would also work to find out if it changed (but not what changed).