04-12-2022 03:51 PM
Hello, I'm trying to build a producer consumer loop.
My issue comes when I want to take the value of some buttons I am displaying on front panel. I don't know how to use the data onto the other loop.
My attempt is to use it to compare on the consumer loop, however I don't know how to transport this down there.
General Picture:
Any suggestions are welcome. 😋
Solved! Go to Solution.
04-12-2022 04:05 PM
Instead of using a queue with just a command enum, make it a cluster with a command enum and a variant. Then you can send whatever you'd like to your other queue. You'd of course need to convert it back from a variant, but you'll always know what type it is ahead of time anyway.
04-12-2022 04:42 PM
Is this what you suggest?
How do I input the data in the variant? do I have to unbundle it too?
04-12-2022 04:54 PM - edited 04-12-2022 04:54 PM
You already do the compare in the consumer loop, right?
If you want to do the compare in the event loop, use event data nodes for new value and old value.
You really need to rethink your approach to the entire program. adding piles of complication does not make the program better by any definition.
Some more comments:
04-12-2022 05:26 PM
@Blancoys wrote:
Is this what you suggest?
How do I input the data in the variant? do I have to unbundle it too?
Use a "Bundle" node, wire your data into the Variant input. LV will convert it to variant automatically, but you'll have to use Variant to Data to convert it back to usable data. Tip, do this inside the specific instruction's loop. This way each instruction can have its own data types.
04-12-2022 06:48 PM - edited 04-12-2022 07:02 PM
I did the changes as suggested and it works properly! I will clean up the code and upload it 😀
As always, Thank you for your time 🐞
04-12-2022 11:29 PM - edited 04-12-2022 11:30 PM
i had the same problem as you and it worked for me if you still get the error but don't know how to follow me for instructions