0

APDS9960 and SparkFun Qwiic Mux not working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

APDS9960 and SparkFun Qwiic Mux not working

by GradeSchool on Wed May 05, 2021 8:34 pm

Hello,

I'm using a SparkFun Qwiic Mux https://www.adafruit.com/product/4704 with some APDS9960 sensors https://www.adafruit.com/product/3595. I'm porting a project from CircuitPython to Arduino (referenced here: https://forums.adafruit.com/viewtopic.php?f=60&t=178401). I'm running the following code on and Arduino Uno.


Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <SparkFun_I2C_Mux_Arduino_Library.h>
#include "Adafruit_APDS9960.h"

QWIICMUX myMux_70;

Adafruit_APDS9960 apds_00;

void setup()
{
  Serial.begin(115200);
  Wire.begin();
  myMux_70.begin(0x70);

  apds_00.begin();
  apds_00.enableProximity(true);
  apds_00.setProximityInterruptThreshold(0, 255); 
}


void loop()
{
  myMux_70.setPort(0);
  Serial.print('A');
  Serial.println(apds_00.readProximity());

  delay(100);
}


I've verified that my sensor responds (when not connected via Mux) and that the Mux and sensor are detected on the I2C bus- using the BasicControl example in the SparkFun_I2C_Mux_Arduino_Library.

My goal is to get one sensor working on one Mux and to build up to 32 sensors across 4 Mux. The above code results in no reading from the APDS9600. Can anyone see an obvious (or not so obvious) issue with this setup? Thanks in advance.
GradeSchool
 
Posts: 34
Joined: Fri May 23, 2008 2:46 pm
Location: South Lake Tahoe, CA

Re: APDS9960 and SparkFun Qwiic Mux not working

by adafruit_support_carter on Thu May 06, 2021 4:14 pm

Try adding a call to setPort() in setup() before initializing the APDS.

Also, since you currently are not using any other outputs, you don't need the call to setPort() in the loop.

adafruit_support_carter
 
Posts: 20281
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.