LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Master Slave Pattern with Events controlled by Joystick

Hi Guys I want to control a Master Slave Pattern based on Events with a Joystick, because I could use this patter like a State Machine and so I can control a RC Car or something like that,  I think that the code is well because when I use a Button in the front panel the Event Case works but if I push a Button from the Joystick the Event Case doesn't works...

 

Could You help me, Please!

 

Best Regards!

 

^Oscar Abraham Sánchez.

Download All
0 Kudos
Message 1 of 7
(3,410 Views)

Read this post.  I don't think it's possible to generate events for joystick buttons directly.  You could acquire the data and output to a cluster and trigger an event based on the value change of the cluster.  Not sure why you would need to do that but it would be possible.

 

http://forums.ni.com/t5/LabVIEW/Value-signaling-property-for-event-button-press-on-joystick/td-p/138...

aputman
0 Kudos
Message 2 of 7
(3,392 Views)

Then I can not trigger an event from a LED Indicator triggered by a Joystick?

Download All
0 Kudos
Message 3 of 7
(3,374 Views)

Hi Abraham,

 

I think you can do it, by forcing an event to occur within your code.

 

If you can use your joystick input to generate a change in a value, such as any indicator, you can continually check to see if the value has been changed (consider using the Timeout Event or another while loop). If the value has been changed, then force an event on the button you used previously. To do this:

 

Create a property node of the button > Value (signaling). Input the new value into this property node to generate the trigger event (to signal a change). As this is linked to the Event for that button the Event will fire and run your respective code.

 

On the surface, I think that'll work. If you need a visual let me know.

0 Kudos
Message 4 of 7
(3,357 Views)

Hey David, could you show me a visual explanation please!

 

Thank You!

 

^Abraham Sánchez

0 Kudos
Message 5 of 7
(3,273 Views)

Hi Abraham - 

 

I've attached a screen shot showing you how to create a property node with a value (signaling) operation, for one of your button indicators receiving a value.

 

When this particular property node (with the signaling operation) receives an updated value it will trigger an event. If this event is registered in your event case (as it already is) then your state machine will operate (as per your code).

 

The thing to note here is that registered events in your event structure will only become active when generated from the front panel. If you want to do it within your code you need to do something different, such as using property nodes.

 

You can get a bit of an idea from reading this post (and those linked within it):

http://forums.ni.com/t5/LabVIEW/Value-Signalling-through-Property-Nodes-What-is-it-doing/td-p/300090

 

I hope that helps.

0 Kudos
Message 6 of 7
(3,265 Views)