Difference between Xinput and HID

Hello! I am trying to program a controller, but I am relativley inexperienced with the HID class, which should I use for a controller, xInput or HID?

1 Like

Are you referring to programming a microcontroller (or something similar) to emulate a controller or something else?

I am not sure what a microcontroller is, I am trying to get a DDR board to function as a controller, when I check it’s identity in driver station, it says that it is a “USB Gamepad”.

1 Like

If you click on the USB Gamepad in the driver station and press something on the physical board do any of the indicators light up? If so then it comes to some programming on the robot side. If you’d like I can point you in the right direction for that if you would like.

Yeah, the buttons come up, I think I have some idea of what to do, I am just not sure whether to us Xinput or HID

So XInput is just a windows api to interact with xbox one and 360 controllers. Xbox controllers are also HID devices. Because a DDR board is not an xbox controller (I’m pretty sure at least) a regular generic HID game controller route is probably the way to go.

Robot Code Stuff If You Need
In your robot code you can do this with a wrapper class for the board. An example of this can be seen in our repo for this year for a thrustmaster joystick. In there you can see lots of JoystickButtons are declared passing this (we can do this because in the abstraction tree this implements GenericHID at some point) and the button id. Everything below line 25 can be pretty much ignored. Hopefully this is what you are looking for.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.