Wiring JoystickGet Buttons to a custom VI

Okay so I’ve created our kicking code and I’ve put it in the teleop VI inside the execute case and everything ect ect.

The code loads it when I press a button and shoots when I press a button + another button, however, I want to just move all this into its own VI, but then I’m not sure how to get the joystick button values wired into the VI I want.

Basically I want to know how to wire the joystick get into a VI I’ve created, instead of making another joystick get, inside of the VI I’ve created.

One of the cool features is to select the nodes you want to be in the subVI. Then move to the Edit menu and choose SubVI from Selection.

LV will make parameters for the wires that cross the boundary in and out, and put the nodes into the subVI along with constants and such.

You sometimes want to be careful doing this with control or indicator terminals, and sometimes LV will tell you that there is a reason you may not want to do this, but it is a helpful tool and helps to prevent making editing mistakes.

To do this by hand, by the way, you’d put the code in the subVI, and you’d have a broken wire as the Button input would be missing. You would place a control on the panel to provide the button value, and you’d right click on the panel icon in the corner to show the connector. Then you can click a spot on the connector and wire the control to it.

Greg McKaskle

Depending on how much you need from your Joystick, you can either wire up the cluster of buttons, and the cluster of axes … or you can wire up individual buttons or axes.

Here’s what I would do, if I wanted all the buttons and all the axes:

  • right click near the right-hand side of a joystick GET function and create an indicator for the axes, and another for the buttons
  • CUT those indicators from that VI and PASTE them into your custom VI
  • select the indicators and change them to controls
  • on the custom VI’s front panel, right-click the VI’s icon in the extreme upper-right of the window and select “Show Connector”
  • select an available little white square, then select the cluster for either the buttons or the axes, then do the same for the other one.

This allows you to wire up the Joystick GET directly into your VI.

In the attached pic, I clicked on the upper right little square, and the DriverAxes cluster became selected. You can do this to see which ports are wired up to which input or output. Typically, you put Outputs on the Right and Inputs on the Left. (The example pic shows 4 outputs from this VI, yours will probably be on the other/input side)

You have to do this from the front panel.

Thanks this helped a lot by providing a cleaner way to make my VI.