RCTransmitter-USBGamepad
RCTransmitter-USBGamepad copied to clipboard
Doesn't Compile??
This code looked like exactly what I needed to wirelessly connect a 72 Mhz FM RC PPM TX to my Mac running X-plane 10 with a 6 channel receiver (eg the JR R610UL). Unfortunately I am NOT a proficient C programmer, and to my dismay when I tried to compile this code to load onto an Arduino nano, it failed as follows:
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Nano, ATmega328P"
/Users/kevan/Documents/Kevan's Stuff/Arduino Projects/RCTransmitter-USBGamepad/RCTransmitter-USBGamepad.ino: In function 'void setup()': RCTransmitter-USBGamepad:99:2: error: 'USBGamepad' was not declared in this scope USBGamepad.begin(rcChannels); //send empty USB report ^~~~~~~~~~ /Users/kevan/Documents/Kevan's Stuff/Arduino Projects/RCTransmitter-USBGamepad/RCTransmitter-USBGamepad.ino: In function 'void loop()': RCTransmitter-USBGamepad:121:7: error: 'USBGamepad' was not declared in this scope USBGamepad.write(rcChannels); //we have complete frame so send usb report with channels data ^~~~~~~~~~ exit status 1 'USBGamepad' was not declared in this scope
===================================================================== The offending lines appear to be:
Line 99 USBGamepad.begin(rcChannels); //send empty USB report Line 121 USBGamepad.write(rcChannels); //we have complete frame so send usb report with channels data
I tried substituting "USBGamepad_" for "USBGamepad" in the offending line, but it didn't help. What is wrong here? Can anyone HELP? Thank you!! Kevan
@Kevan2645 Unfortunately the Arduino nano does not support the usb functionality or libraries that are required to make it behave like a usb game controller. You will need to try a different board that uses the ATmega32U4 processor. I have had great experiences with the SparkFun Qwiic Pro Micro. It is tiny and has usb-c. The official Arduino option is the Arduino micro.