03-19-2023 09:20 AM
I am a novice to the Labview environment and I've been given my first project. I have an idea of just making a "box" of 25 led indicators that display the number given by a numeric control.
As you can see by the screenshot, this is as far as I could get. When I try to input the boolean to the same led indicator I get an error. Can a LED indicator change to have more "ports" so that the error won't appear? Can you help me or just give me a way to make it?
ATTENTION: We have not learned about the more complex stuff (for example functions and arrays) and so I would like to make it using the more basic tools of Labview even if it takes too much space. Thank you!
03-19-2023 02:42 PM
Even if you don't want to use arrays (which would make things 25x simpler without really needing to learn anything new), your Number control needs to be an integer (blue, not orange!).
If you don't want to use functions or arrays, you already failed, because the equal comparison is a "function" in the broadest sense, right?
Are "structures" allowed? If so you can wire the number to a case structure with 10 cases and 10 output tunnels, one for each case.
All that said, your restrictions are completely silly. If using arrays, the code would fit on a postage stamp and there are much fewer places for bugs to hide.
03-19-2023 05:09 PM - edited 03-19-2023 05:16 PM
25 Indicators seams excessive. You only need 7 arranged:
0
1. 2
3
4. 5
6
Yup! A 7 Stroke array just like on your digital clock
I would suggest driving each LED indicator from the output of a Case Structure! You would need 11 cases. One each for integer values 0-9 wiring true to the case output tunnels as appropriate (e.g. Case "8" would be all True and Case 1 would only output True to LEDs 2 & 5.) Make a 11th Case "Default" with no output True to catch decimal values below 0 or >= 10 since those values can not be displayed as a single decimal digit.
PRO TIP: select the option on the seven Case Boolean output tunnels to Use Default if Unwired. The default value of Booleans is False so you will need no False Constants and the wiring will be cleaner without any crossing wires since the value on all wires inside the Cases will always be True.
03-20-2023 05:26 AM
Change the LEDs to a 2D array of LEDs, then simply create a lookup table for each number (as a constant). Then you'll only need 3 primities, the Number control an Index array with the constant and the 2D array Indicator.
03-20-2023 08:38 AM - edited 03-20-2023 08:41 AM
@Yamaeda wrote:
Change the LEDs to a 2D array of LEDs, then simply create a lookup table for each number (as a constant). Then you'll only need 3 primities, the Number control an Index array with the constant and the 2D array Indicator.
Still way too many indicators! . The seven stroke array by case solution is a bit more forgiving. Drop a cluster container around the LEDs and a strict typdef along with the Convert Digit to 7 Stroke Cluster.vi starts a nice lvlib. Format input control for 0b, 0O, and 0x is easy enough to add ( e.g. just add cases to light " A, b, C, d, E and F") add a modified type def to add a LED7 for "-" and LED8 for "." and handle signed and floating point values. Create arrays or cluster of clusters to expand to 2, 3 or more digits.
Eventually you have a pretty sweet lvlib that I personally don't need today but would like to see an example of!
03-20-2023 09:38 AM
@Yamaeda wrote:
Change the LEDs to a 2D array of LEDs,
They said in the "Attention" paragraph that arrays are not allowed.
03-20-2023 09:45 AM
Assuming you relax the silly requirements and allow arrays and clusters, all you need is a very small part of this example. 😄
03-20-2023 10:00 AM
@altenbach wrote:
@Yamaeda wrote:
Change the LEDs to a 2D array of LEDs,
They said in the "Attention" paragraph that arrays are not allowed.
It said they haven't learned it yet. 😉
Still, instead of a look up array i guess they can use a case for the same effect.
03-20-2023 10:44 AM
Silly requirements, yes, but I have to wonder if those hung up on that have never taken a formal college class with LabVIEW. Contrived tasks and silly requirements are abundant.
(And fighting against the rubric in the name of better programming practices rarely gains you any points, but I suppose YMMV depending on the instructor.)
@Seiryuu90 wrote:
ATTENTION: We have not learned about the more complex stuff (for example functions and arrays) and so I would like to make it using the more basic tools of Labview even if it takes too much space. Thank you!
What have you learned about and what are you allowed to use? Is this 5x5 arrangement of LEDs a requirement? Does it actually need to go to 25? (Create a 7-segment decoder is, I think, a more common school assignment.)
First, make sure you use integers as comparisons with floating point numbers are a tricky subject.
Then... well, depends on what you can use. You can create a decoder using "discrete logic" functions if you like. And yes, it would be rather unwieldy and that's very much not the way a pro would do it... but a pro wouldn't be likely to need to do this at all.
It can be simplified if you can use a Case structures or... really any of several features other than basic logic functions.
03-20-2023 11:09 AM