HID-Project.h on Pro Micro Leonardo: HID Project can only be used with an USB MCU.
On Pro Micro (Leonardo):
#if !defined(USBCON)
#error HID Project can only be used with an USB MCU.
#endif
Strange error. Will triggered random using HID-Project in/with some other classes. Run the demo's and working fine without this error. So maybe this is not a reliable way to test capability? I removed this check and everything seems to work fine.
I dont know which classes you use. Can you give me more information about this? Otherwise this seems invalid to me.
If you try to compile (Target: Arduino Leonardo) this code (in zip format, unzip it to project folder):
https://drive.google.com/file/d/0B2l-eQoHefcVRE9LRS1wTHFocG8/view?usp=sharing
You will get the error. Maybe it is because I include the file in a class of mine? I use it as a part of my class. When I test for USBCON myself it is there, but when your code try to detect it, it is not there. Weird. I know the compiler can do sometimes strange things because of the build method that is used, it is not completely error free. I'm using Arduino 1.8.2. Or maybe there is another reason? Please let me know if you get the same error. Thanks for the help.
I aint got time to try this out. I recommend the arduino irc chat on freenode. They can help you, they usually know my library. They possibly use it more than me. I am really sorry. If you ping me at a later date, I might have time to revisit all those newer issues and try them out myself. Sorry.
As a blind guess:
- try to include Arduino.h in your file (before the HID.h)
- Try to include HId.h in the arduino main sketch (if you havent yet)
I got the same issue with the same library and the same board but using platformio to build. Commenting the 3 lines is a functional work around.
Following is the code which triggered it:
#include "HID-Project.h"
void setup() { BootKeyboard.begin(); }
void loop() {
delay(1000);
BootKeyboard.write(KEY_ENTER);
}
I dont know what exactly problem did u have, but it helped,when i commented these lines in main .h file: //#include "SingleReport/RawHID.h" //#include "SingleReport/BootKeyboard.h" //#include "MultiReport/ImprovedKeyboard.h" //#include "SingleReport/SingleNKROKeyboard.h" //#include "MultiReport/NKROKeyboard.h"
Actually, with platformio, including Arduino.h works for me. I should have thoroughly tested what @NicoHood proposed.
Also had this issue with the arduino IDE using platformio seems to of fixed it 👍