I've tried a 1.1k, 3.9k, and 10k pulldown but I still can't get access to the device on the SD0/SC0. I'm using a MPU6050 and was expecting to see 0x70 (of the multiplexer) and 0x68 (of the MPU6050). When I run the scan sketch I can see the 0x70 but nothing else.
After watching about 10 tutorial and reading 2 dozen posting on how to hook this up, there is nothing wrong with my circuit. Is it possible the sketch or compiler is missing a library preventing it from communicating properly?
#include <Wire.h>
#include <i2cdetect.h>
#define AD0 4 // GPIO4
#define AD1 2 // GPIO2
#define AD2 15 // GPIO15
int multiplexer[8][3] = { {LOW,LOW,LOW}, //0x70
{HIGH,LOW,LOW}, //0x71
{LOW,HIGH,LOW}, //0x72
{HIGH,HIGH,LOW}, //0x73
{LOW,LOW,HIGH}, //0x74
{HIGH,LOW,HIGH}, //0x75
{LOW,HIGH,HIGH}, //0x76
{HIGH,HIGH,HIGH} //0x77
};
uint8_t address[8] = { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77 };
uint8_t bus;
int channel = 0;
void setup() {
pinMode(AD0, OUTPUT);
pinMode(AD1, OUTPUT);
pinMode(AD2, OUTPUT);
Serial.begin(115200);
Wire.begin();
Serial.println("i2cdetect example\n");
Serial.print("Scanning address range 0x03-0x77\n\n");
}
void loop() {
Serial.println(channel);
digitalWrite(AD0, multiplexer[channel][0]);
digitalWrite(AD1, multiplexer[channel][1]);
digitalWrite(AD2, multiplexer[channel][2]);
i2cdetect(); // default range from 0x03 to 0x77
/*
Wire.beginTransmission(address[channel]); // TCA9548A address
Wire.write(1 << bus); // send byte to select bus
Wire.endTransmission();
Serial.print(bus);
*/
delay(2000);
channel += 1 ; // increment the channel
if (channel > 7) channel = 0; // reset the counter when at the end of the row
}