LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create 'n' number of leds

Solved!
Go to solution

Thank you so much for the help. Just one more thing. I get the required number of leds but as you can see in the image I have attached, currently I am controlling the leds only with the switches. If I press the 3rd switch, the 3rd led gets switched on. But I want to control it with numeric control. If I insert number 3, I want the 3rd LED to get switched on.What do I have to do ?

0 Kudos
Message 11 of 20
(906 Views)

Instead of the array of switches, initialize a boolean array of the desired size with FALSE, then user "replace array subset" with a TRUE wired to the element and your LED number wired to the index. Display the output in the LED array.

Message 12 of 20
(901 Views)

Every one,thank you so much for you help.

Current Status:

I have been asked to make a few more changes to this. Now every time I insert a number into the "On" numeric the LED corresponding to that number glows. Every time I insert a number in the "Off" numeric, the LED corresponding to that number goes off. For example: If I insert 3 in the "Off" numeric while the third led glowing,it gets switched off. However if I insert 3 while the 5th LED is glowing, nothing happens to the LED as the 3rd LED is already in the OFF state.

 

What I want to add:

On inserting a number(say 3) in the "On" numeric, the corresponding LED(3rd) glows. Now If I am entering another number say 5, I want the 5th LED to get switched on while the third still remains on. In my existing implementation, pressing the LED 5 turns on the 5th led but in that process my 3rd led goes off. I don't want that to happen. 

I want similar thing for the off numeric as well.

I have tried using loops and feedback but unfortunately I am not getting the required solutions.

0 Kudos
Message 13 of 20
(876 Views)

I have also attached the image.

0 Kudos
Message 14 of 20
(875 Views)

Attach our VI that shows your latest attempt.

 

You do need to use a shift register or feedback node.  So if it didn't work for you, you didn't program something correctly and we need to see it to figure out.  Your picture of a piece of the block diagram doesn't show any attempt at a feedback node or shift register.

0 Kudos
Message 15 of 20
(865 Views)

@Akaash_Dragon wrote:

I have also attached the image.


We cannot debug truncated images but this does not even seem to be a real program, just a collection of code fragments.

 

  • you don't even seem to have a loop! How are you running this? (the "continuous run" button is off limits!)
  • Your index controls should be blue (I32)
  • There is a "-1" primitive.
  • Your LED array belongs in a shift register so you can manipulate the LEDs from the current state.
  • ...
0 Kudos
Message 16 of 20
(861 Views)

Sorry about the truncated image. Here i have attached the file itself instead of the image.

And I didn't know that I wasn't supposed to use the "continuous run" button. So in this file I have added a while loop which stops as long as the condition is true. Also I have added a feedback. However I am not getting the required output.

Few questions:

1.Is there a way I can insert the LED number after every single iteration of the while loop?

2.Should the index be blue as I am only going to be inserting only integers or is it because it affects the functionality? 

0 Kudos
Message 17 of 20
(835 Views)
Oh sorry about that. Here I have attached my VI file. Well I had removed the loop and feedback as they were messing the output.
0 Kudos
Message 18 of 20
(833 Views)
Solution
Accepted by topic author Akaash_Dragon

There is no need to post the same the same VI twice.

 

Your VI isn't working because your controls are outside the loop.  That means they are only read once when the VI is first started.  They belong inside the loop.

 

Your indices should be blue because they are only integers.  With orange controls, you could enter 3.1218211324.   what would that mean?

Message 19 of 20
(823 Views)

Thank you so much. Once I put everything inside the loop, I got the output. If I have any other problems, I will comment again in this post.

0 Kudos
Message 20 of 20
(816 Views)