08-08-2024 06:05 AM
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.
Solved! Go to Solution.
08-08-2024 06:20 AM - edited 08-08-2024 06:53 AM
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!
08-08-2024 07:57 AM
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
08-08-2024 08:21 AM
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?
08-08-2024 08:30 AM
please find my full code.
suggest if i can do changes in it.
Regards,
Holas
08-08-2024 08:39 AM - edited 08-08-2024 08:40 AM
08-09-2024 03:19 AM
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.
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
08-09-2024 03:34 AM
@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.
08-09-2024 04:14 AM
Ohh yes, it is working fine i got it.
Thanks, GerdW and UliB.
Regards,
Holas