Your program is only a sub vi and won't perform on it's own.
It's missing some essential stuff like communication with the Driver Station that reads the joystick.
You also need to have the Driver Station app running along with your LabVIEW session.
It would be easiest if you created a default robot project, from the Getting Started window, then added your code to the project.
The default project has most of what you need already, including one joystick.
We can walk you through the steps to take. For example,
- Create a Robot Project (inserting your team number into the IP address)
- Expand the Team Code folder
- Edit the Teleop.vi block diagram
- To begin with use just the Joystick that is already there to display it's buttons.
- Open the Robot Main.vi
- Press the Run arrow to start your project
- Plug your game controller into your laptop
- Start the Driver Station app.
- Go to the Driver Station Setup tab and see if the game controller is listed on the right in the first/top position. If not then click and drag it up to the USB 1 spot.
- Enable the Driver Station.
- Go to the Teleop front panel to see your button displays.
This is the general format to use a joystick
Take a look at some of the NI tutorials at:
https://decibel.ni.com/content/docs/DOC-8923
The
[FRC 2013] FRC Robot Framework Tutorial would be a start.