Datasheet
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print(" ");Serial.println("uT");
tcaselect(6);
mag2.getEvent(&event);
/* Display the results (magnetic vector values are in micro-Tesla (uT)) */
Serial.print("Sensor #2 - ");
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print(" ");Serial.println("uT");
delay(500);
}
However, once you add all the tcaselect()'s you will be able to talk to both sensors!
Multiple Multplexers
Since the TCA9548 is addressible, you can have more than one multiplexer on the bus.
With 8 possible adresses, that means you can control as many as 64 separate i2c buses.
To avoid conflict between devices with the same address on different multiplexers, you can
disable all channels on a multiplexer with the following code:
Wire.beginTransmission(TCAADDR1);
Wire.write(0); // no channel selected
Wire.endTransmission();
© Adafruit Industries
https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-
breakout
Page 19 of 21










