Labview Joystick Buttons...

Hi can someone give me a printscreen of the diagrams in labview to make the joystick buttons work with…lets say a relay. I have a good start but I need some reference to complete what i’ve started

Team 877

Well, I’m on a mac right now but I can give you an explanation.

if I recall correctly, you need to use joystick->get raw data
It gives you an array, if you unbundle by name I think you can access the proper buttons. The unbundle functions can be found under the array section, if you do a right click. Hope you can figure it out from that.

If someone is in their dev environment, please post an image or feel free to correct me.

As a start you can check out my post in THIS THREAD.

It’s not a full reference, but its a bit. I’ll see if I can get a better screenshot for you.

  • Austin

i have all that, but some of the concepts i don’t understand are which axis does what??? and how do i know that button 1 on my unbundle program is actually working there are too many things i don’t understand at this point. also do you have a layout of which button 1-12 goes with what button on the controller?

I don’t have a picture handy or know for certain if all of the buttons match up off the top of my head.

However, while I look for one there is a way you can find out for yourself.

Instead of sending the data to the unbundle function (or I guess you could just have a second wire), right click on the data output of the “Get” VI and select: Create > Indicator. This should put an indicator with labels on you front panel that shows all of the outputs of the joystick. You cam just press the button and see which one lights up on the front panel.

In the meantime I’ll keep looking for a full example of what you’re looking for.

Hope that helps!

  • Austin

Yea this is where I’m confused also.

edit: oops… posted while austin was :stuck_out_tongue:

I’ll try austin’s and reply…

edit2: I tried austin’s technique and I got the buttons in the front panel, but apparently I can’t wire out of the buttons indicator…

yeah i can now get a relay to work off my axis…but not off a button. It’s as if I can’t wire a button anywhere to send the signal to the robot saying engage relay with button 1

I was working with this today and I found out that (on the joysticks that came with the KoP) axis 1 is the x-axis, axis 2 is the y-axis, and axis 3 is the throttle (the dial at the base of the joystick). As for the buttions, I know they’re numbered but I’m not sure if those numbers match the button numbers in Labview. I do know that button 1 is the trigger, though. I hope that helps!

That did help as the trigger is wxactly what I was looking for… don’t know about OP tho…

However, I still can’t figure out how to wire the button out to say, a motor, so that when that button is pressed it activates that motor… well wait… with what I had before (where the buttons are put in the front panel) it wouldn’t let me wire out… but when I do the actual buttons it does… I’m not making sense, am I.

I’m having the same problem…

I know it’s a little late, but here’s my crudely done diagram:
(Sorry, I did it in paint without a mouse :stuck_out_tongue: )

Give me about 15 minutes or so and I’ll get a picture of some way to hook a motor to a button. (It might not be the best way, but I do know a way)

  • Austin

I had it wired to a servo, but I’m sure it wouldn’t be too much different to wire it to a motor. I don’t remember exactly how I did it right now, but I can figure it out once I install Labview onto this computer. It might take half an hour or so…

The diagram helped… but let’s say we want the trigger to link to the “drive close” vi… wiring that gives an error that you can’t wire boolean into that.

i’m waiting for that button diagram haha

Ok, here we go.

I have two examples.

One is of the standard code altered so that pressing Button 1 would simulate moving the joystick to one side of the x-axis:

This next example get rid of the standard drive code completely and replaces it with a system in which Button 4 and Button 5 contol a left and right motors (respectively) to either on or off. (So like on our practice base, Button 4 would turn one side when pressed, Button 5 the other):

Ok, so as you’ve probably noticed, the key is this little guy:

This function converts a boolean value to a numerical value, 0 or 1 (0 false, true 1) It can be found by opening the functions palette and going to: Programming > Boolean and selecting “Boolean To (0,1)”.

I think that’s what you guys are looking for. If you have any more question just ask!

Good Luck!

  • Austin

[EDIT] - And sorry it took me so long, I was needed elsewhere to help with cutting some stuff :stuck_out_tongue: )

thank you so much :slight_smile:

I can’t wire it from the boolean to 0,1 to the close. I have drive close on the outside of my main loop, and it’s wired to the drivedevref global variable, but when I try to wire to it the wire goes dotted. When I try to make another drive close inside the loop and wire to it I get the same problem

Edit: Or is it not possible to set it to drive close? I just wanted to do that so I could test the button input at our next meeting…

The only thing that needs to be sent to the Close VI is the DevRef wire, which is the pink wire that comes out of the “Open Jaguar” or “Open 2 Motor”, etc, VI.

  • Austin

i can get the relay to turn off but not able to engage it…so when I press the button the relay shuts off

So you want to press a button to turn the relay on, release the button and do whatever else you need then be able to hit the same button to turn it off?

Or maybe I’m still misunderstanding you?

  • Austin