LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create 'n' number of leds

Solved!
Go to solution

The user can input some number 'n'. On doing so, 'n' number of LEDs should be created. Then through another numeric control, the user can give another number and the LED corresponding to that number should glow. How do I do this?

0 Kudos
Message 1 of 20
(3,450 Views)
Solution
Accepted by topic author Akaash_Dragon

Use an array of LEDs of the desired size and set the number of visible elements using a property node (within reason, of course). Create a boolean array of that size and replace the desired element with TRUE before sending it to the indicator.

Message 2 of 20
(3,440 Views)

Use an array.  Then you can use a simple property node to set the number of items are displayed.  To update the array value, you just need Replace Array Subset.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 20
(3,437 Views)

@Akaash_Dragon wrote:

The user can input some number 'n'. On doing so, 'n' number of LEDs should be created. Then through another numeric control, the user can give another number and the LED corresponding to that number should glow. How do I do this?


Just to be sure with terminology, you cannot "create" LEDs at run time, however you can hid/unhide any existing LED via property nodes. My array suggestion is easier, so go with that. You can even make the array container transparent.

 

Of course you would also need to add some sanity checks, for example implement a reasonable lower (e.g. 1) and upper (e.g.10) limit for the number of LEDs and then you need to assure that the LED selection is within the valid range. You cannot turn on LED #20 if there are only four LEDs. 😄

Message 4 of 20
(3,419 Views)

Thank you so much. 

I have created the property node. However I am unable to find the option which can make certain leds disappear. If you don't mind, can you help me with that as well? Sorry, but I am just learning labview.

0 Kudos
Message 5 of 20
(3,378 Views)

which property did you choose?

Message 6 of 20
(3,372 Views)

Visible. In this case either the entire array of leds gets hidden or displayed depending on whether the switched is presses or not.So I tried using another property called num columns. 

By using that I am able to create the desired number of bulbs. But is a problem.

There are arrows near the "array of leds" , which lets me choose various values. I want to remove that. 

0 Kudos
Message 7 of 20
(3,369 Views)
Solution
Accepted by topic author Akaash_Dragon

Only use the number of rows (or columns) property. It  will determine the container size, i.e. the number of LEDs shown.

 

To hide the index display do a "right-click...visible items...index display"

Message 8 of 20
(3,358 Views)

Num Cols should work just fine for you.

 

To get rid of the arrows and the index display, right click on the indicator >> Visibility  >> uncheck Index Display

Message 9 of 20
(3,339 Views)

I swear I didn't see Altenbach's message when I went and replied.

Message 10 of 20
(3,327 Views)