I’m trying to connect two triad spectroscopy sensors (AS7265x) to a SparkFun Redboard with Mux and QwiicBus Endpoint in between. The system works fine when I click the two sensors directly to Mux, but whichever sensor is connected with the QwiicBus doesn’t initialize properly. I’m pretty sure it’s a software issue but I’m not sure what’s going on
#include <Wire.h>
#include <SparkFun_I2C_Mux_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_I2C_Mux
QWIICMUX myMux;
#define NUMBER_OF_SENSORS 2
#include "SparkFun_AS7265X.h" //Click here to get the library: http://librarymanager/All#SparkFun_AS7265X
AS7265X **sensor; //Create pointer to a set of pointers to the sensor class
void setup()
{
Serial.begin(115200);
Serial.println("test2");
Serial.println();
Wire.begin();
//Create set of pointers to the class
sensor = new AS7265X *[NUMBER_OF_SENSORS];
//Assign pointers to instances of the class
for (int x = 0; x < NUMBER_OF_SENSORS; x++)
sensor[x] = new AS7265X();
if (myMux.begin() == false)
{
Serial.println("Mux not detected. Freezing...");
while (1)
;
}
Serial.println("Mux detected");
byte currentPortNumber = myMux.getPort();
Serial.print("CurrentPort: ");
Serial.println(currentPortNumber);
//Initialize all the sensors
bool initSuccess = true;
for (byte x = 0; x < NUMBER_OF_SENSORS; x++)
{
myMux.setPort(x);
if (sensor[x]->begin() == false)
{
Serial.print("Sensor ");
Serial.print(x);
Serial.println(" did not begin! Check wiring");
initSuccess = false;
}
}
if (initSuccess == false)
{
Serial.print("Freezing...");
while (1)
;
}
Serial.println("Mux Shield online");
}