SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Qwiic category should be posted in this forum. To learn more about Qwiic, consider checking out our pillar page on the Qwiic system.
By ppelleti
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:
Code: Select all
#include <SparkFun_Qwiic_Twist_Arduino_Library.h>
#include <SparkFun_Qwiic_Joystick_Arduino_Library.h>
I'm getting the error:
Code: Select all
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.