|
Re: USB input controller how to.
It isn't clear what it is you are attempting to do. I think you are trying to read a joystick on the PC. In that case, you will be using the Input Device Control VIs. I think the primary question is how to use the device number input.
This number is determined by the OS when the OS discovers the devices plugged into the USB bus. If devices are plugged in when you run your program, you can often hard code the number, but this will not travel well to other computers, and will have issues when the joysticks are plugged in after running, etc.
The way to use this is to run the VI Query Input Devices. For fun, you can open and run it interactive. It will produce an array of info about the joysticks and other devices. This will sometimes be surprising as laptops will often list a joystick even when one isn't plugged in. This is because they can have an HID device that is actually a specialized joystick, or they can have a BT bridge device that supports both mouse and a joystick. The joystick may not be there at the moment, but since it can show up when BT is ready, they declare it early.
Anyway, the device index to use is the index into the array returned by the Query call. If doing this interactively, you may want to list the items into a listbox and let the user select from the joysticks. More likely, you want to search the array for the device name looking for the mfg name you expect in the array.
If I'm way off on what you are asking, please try again.
Greg McKaskle
|