Sparkfun TCA9548A Qwiic Mux

I want to read with an Uno from 5 different Sparkfun Grid-Eye sensors connected to the TCA9548A mux. Does anyone have any code for this? The Grid Eye sensors all have the same i2c address.

they have a library for the MUX with examples

Dear J-M-L

Many thanks for getting back to me. I have downloaded the Example1_BasicControl from the library you referenced but my problem is that I can’t figure out how to add the code to read from the Grid-Eye sensors.

Would you be able to advise?

Kind regards

Robert Mayo


you use the library to set the active MUX port (where I2C commands will go) by using mux.setPort(xxx); where mux is your QWIICMUX instance and xxx the port you want to select.

Once this is done you send a normal command to your Sparkfun Grid-Eye sensor, it will be routed to the sensor attached to the active MUX port

Dear J-M-L

I am a novice and greatly appreciate your help with this.

Assume “mux.setPort” goes under void setup(). Do I need to include Wire.begin().

Have copied my code, which works 100% when I connect the Grid-Eye directly to the Arduino over i2c, but the code does not work when I copy it into the void loop() of the mux code.

Any suggestions you might have would be very helpful.


Robert Mayo


Hello Robert

nothing wrong being a novice, we all started there.

I would suggest to study the examples that come with the library , start with Example1_BasicControl.ino

you'll see how they set it up.

Dear J-M-L

Many thanks for your first class help. Have now got the application working. A great feeling!

Best regards


great news. Have fun