LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling a multiple LED on/off from single control

Solved!
Go to solution

Hello,

 

I am writing the code to control the multiple LED on/off, from single master control as well as individual control for all LEDs. i have tried with local variable but in that case i can just turn all ON/OFF only but i can't control the individual LED.

 

attached my code here.

0 Kudos
Message 1 of 9
(863 Views)

Hi holas,

 


@Holas1505 wrote:

i have tried with local variable but in that case i can just turn all ON/OFF only but i can't control the individual LED.


THINK DATAFLOW!

You cannot control your individual buttons because you overwrite your manual input with all those local variables…

 

You should only write to those locals when the value of "ALL ON/OFF" changes. Easiest would be to use an event structure…

 

Btw. you had about 3 months to learn about DATAFLOW and locals!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(853 Views)

Hi gerdW,

 

i have already made the code with event structure and it is working but was finding some other short method.

 

So, asking for other easy way of doing it.

 

Regards,

Holas

 

Holas1505_0-1723121789758.png

 

0 Kudos
Message 3 of 9
(825 Views)

Hi Holas,

 


@Holas1505 wrote:

i have already made the code with event structure and it is working but was finding some other short method.


Which "other short method" did you find?

 


@Holas1505 wrote:

So, asking for other easy way of doing it.


Why is there a sequence structure in your image?

Why is there a case structure inside the event structure?

Why are there so many scalar booleans and why don't you put them inside a cluster?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(819 Views)

please find my full code. 

 

suggest if i can do changes in it.

 

Regards,

Holas

0 Kudos
Message 5 of 9
(811 Views)
Solution
Accepted by topic author Holas1505

Hi Holas,

 

simplified:

"DOs" is a cluster of your 11 DO controls…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(808 Views)

Hi GerdW,

 

Holas1505_0-1723191261054.png

this cluster allows me only 9 elements, then how can i take a take a local variable of cluster DO which has 11 elements. so it is giving me a error.

 

Holas1505_2-1723191410949.png

 

i also want to give control to each LED separately so for that i will need a separate DO local variable, then how can i do that with cluster DO of 11 elements.

 

 

Regards,

Holas

 

0 Kudos
Message 7 of 9
(760 Views)

@Holas1505 wrote:

Hi GerdW,

this cluster allows me only 9 elements, then how can i take a take a local variable of cluster DO which has 11 elements. so it is giving me a error.

The size is configurable. Right click 'Array To Cluster' and choose 'Cluster size ...'.

 


i also want to give control to each LED separately so for that i will need a separate DO local variable, then how can i do that with cluster DO of 11 elements.


No, you do not need another local variable.

As GerdW wrote in his code: Put the terminal and the DAQ Assistant in the 'Timeout Case'. Every timeout the latest values of each DO within the cluster are read and flow to the DAQ Assistant.

 

 

0 Kudos
Message 8 of 9
(753 Views)

Ohh yes, it is working fine i got it.

 

Thanks, GerdW and UliB.

 

Regards,

Holas

 

 

0 Kudos
Message 9 of 9
(740 Views)