04-07-2023 12:09 PM
@altenbach wrote:
You really (really!!!!!) need to start over. There should be absolutely no need for references and local variables at all! This is just all complete Rube Goldberg!
See if this can give you some general ideas. (Yes, it does something else, but the principle is the same)
04-07-2023 04:18 PM
In this project I cant just use arrays because I use custom controls with .gif images and the animation glitches out when inside an array so I have to use each of the indicators uniquely. Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?
04-07-2023 06:18 PM - edited 04-07-2023 09:19 PM
You can code in arrays and have a big transparent cluster on the front panel containing all your custom booleans. Then just convert cluster <> array for display.
04-07-2023 06:28 PM
@Seiryuu90 wrote:
In this project I cant just use arrays because I use custom controls with .gif images and the animation glitches out when inside an array so I have to use each of the indicators uniquely. Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?
Probably there is BUT, I would do it with an Event structure. You would create a value change event for your last ( end trigger) boolean reading the new value node and the new value with your rectangular ( end enable) boolean, set as "switch when released", to exit the Event loop. You would also create either a value change event for left value change, right value change and execute Altenbach's code there or in a timeout event.
04-07-2023 07:15 PM
Thank you for your reply but unfortunately I dont get much of what you described. I know somethings about event and how to set a value change but I lose you at the part you're talking about the "end trigger" and "end boolean" stuff. I am kinda new to this software.
04-08-2023 09:28 AM - edited 04-08-2023 10:13 AM
@Seiryuu90 wrote:
Thank you for your reply but unfortunately I dont get much of what you described..... I am kinda new to this software.
The problem is obviously inexperience and looking at your code you are just piling on completely wrong code constructs, creating an unmaintainable house of cards. You might get it to work eventually, but there is no elegance. All that could be done with 10% of the code using no local variables and no references at all.
I get the feeling that you are an experienced text programmer. Nothing wrong with that! You need to forget all the bad habits that you acquired by trying to blindly apply concepts from text languages to a highly parallel dataflow language (For example, LabVIEW has no "variables"! The wire is the variable! Local variables are just secondary access to UI elements). Start with the learning resources listed at the top of the forum. Look at the examples and design templates that ship with LabVIEW.
So far, this all looks like an experienced auto mechanic trying to do heart surgery using a socket wrench and screwdriver. It's just not right!
There are no shortcuts to learning the basics!!!
....
Hmmm.... Well, there are actually shortcuts! Start by attaching your code so we can see the UI (they can be plain LEDs at this stage, you can substitute custom controls later). Then explain step by step what the user does and what should happen as a function of user interaction and time. Code pictures are completely useless. (To keep the auto mechanic analogy going, except for rare cases, we cannot tell from a picture what's wrong with the car). Yes, to most of us, your LabVIEW code looks as follows... 😄
04-08-2023 11:36 AM
@altenbach wrote:
You can code in arrays and have a big transparent cluster on the front panel containing all your custom booleans.
Here's how that could look like:
You still need to learn about clusters and cluster order, for example. All the basics!
04-09-2023 11:52 AM
@Seiryuu90 wrote:
Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?
On a side note, "measure" is the wrong term here.
Indicators are just passive UI elements that display whatever is wired to them, so the data value you are interested in is in that wire leading to it. Indicators are not meant to be abused for data storage as you seem to do (Yes, they do have their own memory and transfer buffer because the UI handling is asynchronous. This also means that every local variable creates additional data copies in memory). Once you start using value references and local variables, their value depends on whatever wrote to it last, which is completely undetermined in your code. All your disconnected "code islands" execute in random order or even in parallel (If you have multiple cores as most do). Only wires can define execution order and you always know where the data comes from and where it is going. In very rare cases, sequences structures can be use to further enforce a certain order if really needed.
Dataflow is a very powerful paradigm: Just follow the wire!!! Once you realize the power AND elegance of it, you'll never go back to text programming. 😄
04-11-2023 07:35 AM
Thank you for the information and your advice! But I'd like to learn a way for this particular block diagram (autoindexed array) to just read the value when the last boolean is true.
04-11-2023 07:57 AM
@Seiryuu90 wrote:
Thank you for the information and your advice! But I'd like to learn a way for this particular block diagram (autoindexed array) to just read the value when the last boolean is true.
Delete from array will give the last element as removed per default. Or, as Altenbach said, use the end reference of the loop.