I do have some trouble with the USBHIDJoystick library and need some help...
I get the following compiler failure:
In file included from hidjoystickrptparser.cpp:1:
hidjoystickrptparser.h:34: error: 'USBHID' has not been declared
hidjoystickrptparser.cpp:11: error: variable or field 'Parse' declared void
hidjoystickrptparser.cpp:11: error: 'USBHID' was not declared in this scope
hidjoystickrptparser.cpp:11: error: 'hid' was not declared in this scope
hidjoystickrptparser.cpp:11: error: expected primary-expression before 'bool'
hidjoystickrptparser.cpp:11: error: expected primary-expression before 'len'
hidjoystickrptparser.cpp:11: error: expected primary-expression before '*' token
hidjoystickrptparser.cpp:11: error: 'buf' was not declared in this scope
Here the .ino:
#include <usbhid.h>
#include <hiduniversal.h>
#include <usbhub.h>
// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif
#include "hidjoystickrptparser.h"
USB Usb;
USBHub Hub(&Usb);
HIDUniversal Hid(&Usb);
JoystickEvents JoyEvents;
JoystickReportParser Joy(&JoyEvents);
void setup() {
Serial.begin(115200);
#if !defined(__MIPSEL__)
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
#endif
Serial.println("Start");
if (Usb.Init() == -1)
Serial.println("OSC did not start.");
delay(200);
if (!Hid.SetReportParser(0, &Joy))
ErrorMessage<uint8_t > (PSTR("SetReportParser"), 1);
}
void loop() {
Usb.Task();
}
go to your file system and remove the USB_Host_Shield_2.0 library from your arduino libraries folder (assuming you added it automatically from the library manager, it seems not all files get installed).
C:\Users\...\Documents\Arduino\libraries\USB_Host_Shield_20\PS3BT.cpp: In member function 'float PS3BT::getAngle(AngleEnum)':
C:\Users\...\Documents\Arduino\libraries\USB_Host_Shield_20\PS3BT.cpp:107: error: 'atan2f' was not declared in this scope
C:\Users\...\Documents\Arduino\libraries\USB_Host_Shield_20\PS3BT.cpp:109: error: 'atan2f' was not declared in this scope
well yes that sounds very weird. Reinstall the IDE to ensure you have the latest libs, use the automated library update process to ensure you have everything up to date and download the library as suggest above and manually install (when I tried to install with the library tools I was missing usbhid.h.