using Qwiic Joystick with Qwiic Twist

I have the Qwiic Joystick (COM-15168) and Qwiic Twist (DEV-15083) and want to use them at the same time.

I’m using the Qwiic Joystick library version 1.0.4 and the Qwiic Twist library version 1.0.2. When I include both in the same sketch:

#include <SparkFun_Qwiic_Twist_Arduino_Library.h>
#include <SparkFun_Qwiic_Joystick_Arduino_Library.h>

I’m getting the error:

In file included from /Users/ppelleti/Documents/Arduino/SDMatrixPicture/SDMatrixPicture.ino:6:0:
/Users/ppelleti/Documents/Arduino/libraries/SparkFun_Qwiic_Joystick_Arduino_Library/src/SparkFun_Qwiic_Joystick_Arduino_Library.h:34:6: error: multiple definition of 'enum encoderRegisters'
 enum encoderRegisters {
      ^
In file included from /Users/ppelleti/Documents/Arduino/SDMatrixPicture/SDMatrixPicture.ino:5:0:
/Users/ppelleti/Documents/Arduino/libraries/SparkFun_Qwiic_Twist_Arduino_Library/src/SparkFun_Qwiic_Twist_Arduino_Library.h:40:6: note: previous definition here
 enum encoderRegisters {
      ^

Is there any way to use both of these libraries in the same sketch? Thanks!

Hey there, that is my bad. I updated the library to rename the variable for the register map. The library version should get automatically updated by Arduino… look for version 1.0.5.

Otherwise, if you know where the header file for the library is and want to make the changes manually, you just need to rename the [encoderRegister variable on this line in the Qwiic Joystick library.](SparkFun_Qwiic_Joystick_Arduino_Library/src/SparkFun_Qwiic_Joystick_Arduino_Library.h at master · sparkfun/SparkFun_Qwiic_Joystick_Arduino_Library · GitHub)