12-10-2014 03:32 PM
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.
12-10-2014 04:26 PM
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.
12-10-2014 07:23 PM
Then I can not trigger an event from a LED Indicator triggered by a Joystick?
12-10-2014 08:24 PM
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.
12-16-2014 09:29 PM
Hey David, could you show me a visual explanation please!
Thank You!
^Abraham Sánchez
12-16-2014 09:52 PM - edited 12-16-2014 09:53 PM
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.
12-16-2014 09:54 PM