LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Joystick Case only operating once when clicked

Hello,
 
I am trying to program a VI to interface with a joytick. Once I click a button on the joystick I just want the case structure to execute once. Basically only execute when the button goes from false to true. What is the best way to acomplish this? I tried to execute this with a case structire but when I click the button it executes many times. I have attached example code below.
 
Thanks
0 Kudos
Message 1 of 11
(3,665 Views)
You would probably be better off using an Event Structure to handle the mouse down event on the button. Check out the Event Tracking.vi shipping example.

Cheers
0 Kudos
Message 2 of 11
(3,663 Views)
I tried to do an event strucute but I cannot get it to work. I don't know how to take in a button pressed on a joystick and use it in an event. I know how to do it with a button in labview but not with a joystick button.
0 Kudos
Message 3 of 11
(3,659 Views)
You could try using the Value Change event connected to an indicator boolean which will go to true when the joystick button is pressed (you will want to hide the indicator so it is not visible on the front panel).  This is assuming that you are able to detect the button press in labview.

Cheers
0 Kudos
Message 4 of 11
(3,656 Views)

Hello,

 

I tried to do this but it did not work. It seems to not see the event. Here is copy of my vi. Can anybody tell me why the even is not being seen?

0 Kudos
Message 5 of 11
(3,653 Views)
Once the joystick button is hit does it act like a latched control or a switch?  It appears that all you want to do is count the number of times the button is hit, is this the case?


Message Edited by jmcbee on 03-13-2008 10:58 AM
0 Kudos
Message 6 of 11
(3,648 Views)
I apologize for the event structure, after a little investigation I have found that you cant trigger an event off of an indicator.  However, attached are two vi's, one for the case that the joystick button is latching, and one for the case that it is switching.  Post back if they arent and either myself or someone else will offer another suggestion.


Cheers
Download All
0 Kudos
Message 7 of 11
(3,644 Views)

Hello,

 

Basically yeah I want to count the number of times it is hit. I am just using that as an example. What I really want to do it spit out a command to a serial port only once when I hit the button, not spit out a bunch. Also I cannot open up the VI's that people sent since I am using Labview 8.2. Can you save them as a leter version or take a screen shot?

 

Thanks

0 Kudos
Message 8 of 11
(3,641 Views)
Here are the two VI's I sent saved as 8.2
Download All
0 Kudos
Message 9 of 11
(3,639 Views)

Hello,

 

I tried the VI and it is very close to what I want it to do. But when I click the joystick button down it increments the value. And also when I take my finger off the button it increments the value. I would like to have it just increment the value when it goes from false to true not true to false.

0 Kudos
Message 10 of 11
(3,611 Views)