error help

I keep getting this error when I try to verify the sketch. Help please.

Arduino: 1.8.13 (Windows 10), Board: “Arduino Nano, ATmega328P”

ARDUINO_BUTTON_BOXV2:97:1: error: ‘Joystick_’ does not name a type; did you mean ‘Joystick’?

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,

^~~~~~~~~

Joystick

C:\Arduino\libraries\32-FUNCTION-BUTTON-BOX-master\ARDUINO_BUTTON_BOXV2\ARDUINO_BUTTON_BOXV2.ino: In function ‘void setup()’:

ARDUINO_BUTTON_BOXV2:103:11: error: expected unqualified-id before ‘.’ token

Joystick.begin();

^

C:\Arduino\libraries\32-FUNCTION-BUTTON-BOX-master\ARDUINO_BUTTON_BOXV2\ARDUINO_BUTTON_BOXV2.ino: In function ‘void CheckAllButtons()’:

ARDUINO_BUTTON_BOXV2:124:39: error: expected unqualified-id before ‘.’ token

Joystick.setButton(buttbx.key*.kchar, 1);*

  • ^*
    ARDUINO_BUTTON_BOXV2:128:39: error: expected unqualified-id before ‘.’ token
    _ Joystick.setButton(buttbx.key*.kchar, 0);_
    _
    ^_
    C:\Arduino\libraries\32-FUNCTION-BUTTON-BOX-master\ARDUINO_BUTTON_BOXV2\ARDUINO_BUTTON_BOXV2.ino: In function ‘void CheckAllEncoders()’:
    ARDUINO_BUTTON_BOXV2:159:15: error: expected unqualified-id before ‘.’ token
    Joystick.setButton(rotaries_.ccwchar, 1); delay(50); Joystick.setButton(rotaries.ccwchar, 0);
    ^
    ARDUINO_BUTTON_BOXV2:159:70: error: expected unqualified-id before ‘.’ token
    Joystick.setButton(rotaries.ccwchar, 1); delay(50); Joystick.setButton(rotaries.ccwchar, 0);
    ^
    ARDUINO_BUTTON_BOXV2:162:15: error: expected unqualified-id before ‘.’ token
    Joystick.setButton(rotaries.cwchar, 1); delay(50); Joystick.setButton(rotaries.cwchar, 0);
    ^
    ARDUINO_BUTTON_BOXV2:162:69: error: expected unqualified-id before ‘.’ token
    Joystick.setButton(rotaries.cwchar, 1); delay(50); Joystick.setButton(rotaries.cwchar, 0);
    ^
    Multiple libraries were found for “Joystick.h”
    Used: C:\Users\User\Documents\Arduino\libraries\Joystick*

    * Not used: C:\Program Files (x86)\Arduino\libraries\ArduinoJoystickLibrary-master*
    exit status 1
    *'Joystick’ does not name a type; did you mean ‘Joystick’?
    This report would have more information with
    _“Show verbose output during compilation”*
    option enabled in File → Preferences._

Funny how much this sounds like the question in this thread:

Are you posting under two user names?

@kcduncan

Could you take a few moments to Learn How To Use The Forum You appear to have bypassed those on the way in..

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano, ATmega328P"

If this is someone else, the Joystick library only works with processors with native USB support, like Leonardo.

Look at the library examples to see how to declare Joystick objects and how to use the library.

aarg:
Funny how much this sounds like the question in this thread:
https://forum.arduino.cc/index.php?topic=725360.0
Are you posting under two user names?

No i am not posting under two names. I read this one as well trying to seek out help to my issue. I made a button box once before and it worked without any problems. Now im just trying to figure out what the error could be. I dont have alot of experience with this stuff and was hoping someone who had more experince wthatn I do would be able to spot the error or know how to fix the error.

@kcduncan. Please post a link to where you found this code. There may be some information there that will allow us to more effectively help you.

"@kcduncan. Please post a link to where you found this code. There may be some information there that will allow us to more effectively help you."

Pert, here is the link to the button box i previously made, it works perfect. Not sure what the difference is, but would appreciate any help.


That instructables has a link to the joystick library the sketch was written for:

if you check the readme, it says which boards it is compatible with:

As @groundFungus explained, this library is not compatible with the Nano.

But this is not the cause of the error you're getting (though it will cause another error later if you continue to try to use the Nano with this library). As you can see from the output:

kcduncan:
Multiple libraries were found for "Joystick.h"

Used: C:\Users\User\Documents\Arduino\libraries\Joystick

Not used: C:\Program Files (x86)\Arduino\libraries\ArduinoJoystickLibrary-master

You have multiple joystick libraries installed on your computer. The Arduino IDE has to pick one of the two. Unfortunately, in this case it picked the wrong one. The solution is to delete this folder:
C:\Users\User\Documents\Arduino\libraries\Joystick
That will cause the Arduino IDE to use the right library that is in the other folder.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.