Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use an XBOX or PS4 controller with LabVIEW on Windows 10?

Solved!
Go to solution

Hi!

 

I have tried to use both an XBOX and a PS4 controller with LabVIEW on Windows 10 but have not been able to make it work.

I use LabVIEW 2020 SP1 f1 64bit on Windows 10 and have downloaded the MakerHub interface XBOX One and PS4 Controller packages with the VI Package Manager.

The controllers have been connected wirelessly or with USB cable and Windows can connect to the controllers and are visible under Bluetooth and other devices.
My problem is that no controller is found when running an example and I am not sure what the problem is. Are these packages too old and they have stopped working? Is there something missing so I have to install something more? Or should I use some other solution?

 

Anyone who can help me to get this to work?

 

0 Kudos
Message 1 of 9
(4,410 Views)
Solution
Accepted by LabEye

Hey LabEye,

 

why to use XBOX or PS4 if SNES is the only controller that you need? Jkidding

There are several ways to get data from USB or Wireless controllers. I'll point the one i use when i need a fast data acquisition.(by fast i mean testing and prototyping)

First, if you use hidHide for whatever reason, make them visible.

Then, on LabVIEW, under the connectivity pallete, there is the Joystick pallete.
all you have to do is, initialize the controller (you may check ID on the windows controller configuration 0 is the first on list, 1 is the second, so on...)

inside a loop you use the acquire input data.vi to get status from direction, axis and buttons.

outside the loop you use clos input device.vi to release serial communication so that you may play your games.

 

here is a picture (can't attach VI right now, sorry for that)


jorgemondadori_0-1662122212816.png

 

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
Message 2 of 9
(4,398 Views)

Hi Jorge,

 

Thank you for your help!

I have tried what you suggested below but for some reason LabVIEW does not seem to find my game controller(s).

The controller(s) is/are visible in Windows like you showed in your image and I can also test their functionality there. Using DS4Windows does not change anything (and I am not using hidHide).

Using the "Query Input Devices.vi" I can see my keyboard under "key info" and mouse under "mouse info" but under "joystick info" I get 7 devices and none of them is my game controller.

 

I am not sure what I can try next.

 

Best Regards,

 

Richard

0 Kudos
Message 3 of 9
(4,354 Views)

Hey LabEye, since it is not a Hobbyist Toolkit Issue anymore, i would move this topic to LabVIEW section to get more visibility.

next, i would try:

 

- Installing LabVIEW 32bits
- Ensure Launching LabVIEW with administrator privileges

Is your LabVIEW isntalled in the same drive as your OS? Like c:/ ?

There are some more experienced guys in LabVIEW around this forum that may also contribute...

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
Message 4 of 9
(4,346 Views)

Hi Jorge,

 

Launching LabVIEW with administrator privileges solved the problem 🙂

 

Thanks,

 

Richard

Message 5 of 9
(4,341 Views)

yoooo nice!

Hey, just as curiosity, would you like to share what are you doing? just for fun?

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 6 of 9
(4,336 Views)

I am do a quick and dirty proof of concept where I am controlling the tilt of a mirror directing a laser beam with stepper motors and I think it would be nice to use a game controller to remotely control the mirror position.

Would be nice if it was possible to use a wireless controller. So far it only works when the controller is connected over USB.

Do you know if there is a wireless solution that works?

 

Best regards,

 

Richard

0 Kudos
Message 7 of 9
(4,332 Views)

i always prefer usb, but using ds4windows helped connecting through bluetooth. xbox controller i dont know because i dont have one. i have also used a POKKEN CONTROLLER for nintendo switch, that worked ok wirelessly

Jorge Augusto Pessatto Mondadori, PhD
Sistema Fiep
CLAD, CLD
0 Kudos
Message 8 of 9
(4,325 Views)

My problem with the wireless controller might be that the number of joysticks is limited to 8. All extra controllers I connect don't show up (USB or Bluetooth).
Instead I found this solution which works for both USB and Bluetooth controllers https://forums.ni.com/t5/LabVIEW/Query-Joysticks-Access-violation/m-p/3597290#M1007969

 

Best regards,

 

/Richard

0 Kudos
Message 9 of 9
(4,323 Views)