annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Trouble taking data from event structure

Résolu !
Accéder à la solution

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.

 

Blancoys_0-1649796533228.png

 

My attempt is to use it to compare on the consumer loop, however I don't know how to transport this down there. 

Blancoys_2-1649796667760.png

 

General Picture: 

 

Blancoys_3-1649796692847.png

 

 

 

Any suggestions are welcome. 😋

 

 

 

 

0 Compliments
Message 1 sur 7
1 946 Visites
Solution
Accepté par l'auteur du sujet Blancoys

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.

Message 2 sur 7
1 939 Visites

Is this what you suggest?

 

Blancoys_0-1649799713761.png

 

How do I input the data in the variant? do I have to unbundle it too?

 

0 Compliments
Message 3 sur 7
1 924 Visites

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.

altenbach_0-1649800009835.png

 

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:

  • Loop.vi: Your loop VI should only have one input. The constant belong inside the subVI as diagram constants.
  • checkbutton.vi: the -1 exception belong inside the subVI.
  • trnasaction.vi: Get rid of that refernce and property node. Pointless. Find a logical terminal layout. This is NOT it!

altenbach_1-1649800374993.png

 

Message 4 sur 7
1 917 Visites

@Blancoys wrote:

Is this what you suggest?

 

Blancoys_0-1649799713761.png

 

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.

Message 5 sur 7
1 902 Visites

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 🐞

0 Compliments
Message 6 sur 7
1 887 Visites

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

0 Compliments
Message 7 sur 7
1 857 Visites