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.
#205030
Hello,
I have a Qwiic Joystick (COM-15168). I recently found an issue with the checkButton() function in the Qwiic Joystick Arduino library. I looked at the library code and I believe the issue may be in the joystick firmware itself.

Reading the button status through the Arduino library checkButton() function or even directly through i2c calls to read register 0x08 always returns 1. The register never seems to clear after being explicitly set to 0x00 through a write call in the Arduino library.

Here is Arduino code to based on Example 1 to duplicate the problem.
Code: Select all
#include <Wire.h>
#include "SparkFun_Qwiic_Joystick_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_joystick
JOYSTICK joystick; //Create instance of this object

void setup() {
  Serial.begin(9600);
  Serial.println("Qwiic Joystick Example");


  if(joystick.begin()) {
    Serial.print("Version: ");
    Serial.println(joystick.getVersion());
  } else {
    Serial.println("Joystick does not appear to be connected. Please check wiring. Freezing...");
    while(1);    
  } // if-else begin
}  // setup

void loop() {
  Serial.print("X: ");
  Serial.print(joystick.getHorizontal());

  Serial.print(" Y: ");
  Serial.print(joystick.getVertical());
  
  Serial.print(" Button: ");
  Serial.print(joystick.getButton());

  Serial.print(" Status: ");
  Serial.println(joystick.checkButton());

  delay(200);
} // loop
Running this code and pressing the button produces the following output. Please note that status value is always 1.
Code: Select all
Qwiic Joystick Example
Version: v2.4
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 0 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
X: 504 Y: 500 Button: 1 Status: 1
Reading the register 0x08 directly in python on a Raspberry pi has the same result. I opened an issue on GitHub in the Sparkfun/Qwiic_Joystick repository for this, if you need to track the change there. Please let me know if there's anything else Sparkfun would like me to do.

Thanks,
Gaston
#205038
Hi Gaston,

Thanks for bringing this to our attention! Filing an issue on the GitHub repository should ping the engineers assigned to that repo so they will take a look and depending on their schedule, should respond to it soon. I can also test this with a known good board here and ping them directly to get this issue fixed.