Reading data from a USBHID controller, and using it

Hello,

for my project, I'm trying to use a racing sim button box (USB), to send data (1 or 0) to my Arduino, what in turn will function as inputs for the rest of my system (to power some relays for actuators)

the problem I'm having is not to receive the data (I'm using the USBHID_desc program for my USB host shield to receive the data, and i can see the buttons being pressed in the serial monitor) but is how to translate the data i can see in the monitor, to something i can actually use as a input. ( if (usbinput) == 1 then ... or something like that)

any advice?

(USB_Host_Shield_2.0/USBHID_desc.ino at master · felis/USB_Host_Shield_2.0 · GitHub)

i am just using a device that my PC recognizes as a USBHID device (it can be used in racing simulators) and using a USB host shield to connect the HID device to the arduino mega:

This is some of the data I receive from the serial monitor, if i press the button on my USB device, i see one of the 00's turn into a 01:

Summary

(00)Btn0001
(00) Btn0002
(00) Btn0003
(00) Btn0004
(00) Btn0005
(00) Btn0006
(00) Btn0007
(00) Btn0008
(00) Btn0009
(00) Btn000A
(00) Btn000B
(00) Btn000C
(00) Btn000D
(00) Btn000E
(00) Btn000F
(00) Btn0010
(00) Btn0011
(00) Btn0012
(00) Btn0013
(00) Btn0014
(00) Btn0015
(00) Btn0016
(00) Btn0017
(00) Btn0018
(00) Btn0019
(00) Btn001A
(00) Btn001B
(00) Btn001C
(00) Btn001D
(00) Btn001E
(00) Btn001F
(00) Btn0020

Post a wiring diagram of the box and the Arduino.

1 Like

The "schematic" is really not much, i am just using a device that my PC recognizes as a USBHID device (it can be used in racing simulators) and using a USB host shield to connect the HID device to the arduino mega