11-03-2014 03:24 PM
Hello, I'm very new to Labview and would like some help in writting a vi.
Currently I am successful in using simple switches on the fornt panel to control multiple led/resistors connected to digital out lines, but how would I go about saving their states? I want to save (or prescribe?) the on/off state for multiple lines and be able to choose that combination with a dropdown menu or multiple buttons on the front panel.
Thanks for looking.
11-03-2014 03:36 PM - edited 11-03-2014 03:58 PM
This is actually reasonably complex for a beginner to program, but it should be doable.
You should be able to save the desired values into a 2d array, with each column indicating a single LED and each row a different configuration, then when saving or selecting from your dropdown menu you will reference an individual line that can be applied to the outputs.
<Edit>
I forgot to mention that Shift registers are your friend here for storing data that you dont really want to persist, if you want them to persist then you are going to need to get into XML or ini files. Shift registers allow data to persist within a loop and are used to pass data from the end of a loop back to the beginning.
(Shift registers are used by right clicking on the entrance into a while or for loop and selecting "Replace with Shift Register")
11-03-2014 03:39 PM - edited 11-03-2014 03:54 PM
If the contents of the drop-down are known in advance, you could use an enum to implement the dropdown. The code might look something like this to adjust the values of the buttons in response to changing the enum:
If you want the user to be able to interact with the boolean controls and save new configurations within the dropdown, it becomes a bit more involved. In this case you would need use a ring control with dynamically populated items for the dropdown itself, and you would need to save the boolean states in a manner that scales to an arbitrary number of dropdown selectors (like what ogk.nz suggested above). You would probably want to also store all of this information to a config file so the user configurations would be saved for the next time the program is run.
Best Regards,