Closed kingfisher09 closed 4 years ago
Not sure why it's not working. Could be a problem related to the Arduino Micro board?
This will never work: Joystick_ Joystick();
because C++ interprets this as a function definition (or a function pointer, I'm not 100% sure). But the other variants should all work. What're the error messages you get for the Joystick_ Joystick;
variant?
I get:
Error compiling for board Arduino Micro.
I seem to get this error whatever board I try to compile for. I also tried compiling for the Leonardo and the Uno...
I found that if I move the constructor to the setup then it will compile. However when I did that, the Arduino crashed every time it ran.
Ok, I've found the problem. I'm an idiot and I seem to have downloaded an old version of the repository. Thanks for you help!
Description of Issue
This is probably a really easy fix but I'm new to Arduino and it's got me stumped.
I'm having problems creating the Joystick constructor using Joystick_ Joystick. I have tired a few different things as listed below.
At first my constructor looked like this:
However that gave the error: 'JOYSTICK_DEFAULT_REPORT_ID' was not declared in this scope
So I tried:
Which gave the error: no matching function for call to 'Joystick::Joystick(int, int,......
So then I tried just:
Which gave the error: Error compiling for board Arduino Micro.
Finally I tried
Which gave the error: 'Joystick_ Joystick()' redeclared as different kind of symbol
So now I'm really puzzled. What am I doing wrong?
Technical Details