My idea was to have multiple MPU 6050 (6-DOF accelerometer) sensors connected and read by an NodeMCU. I had tested a single accelerometer on the D1, D2
pins and it worked perfectly (using the `Adafruit MPU 6050 library).
Given that multiple sensors need to communicate via different pins I now wanted to try to use different pins, such as the D0, D1
for instance.
I read the Adafruit Documentation and came to the conclusion that I might be able to use different TwoWire
connections. So my code that I tried looked like:
Wire.begin(16, 5);
if (!mpu.begin(ßx68, &Wire, 0)) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}
given that the D0, D1
pins should correspond to the integers 16 and 5 according to the pinout schemas and according to the source code of the wire library, which specifies that the begin method sets the SDA and SCL pins if specified.
Unfortunately though, my serial prints that the chip that I connected can not be found (its powered, as confirmed by the LED...). I would really appreciate help on how to connect I2C devices on different pins! Thanks in advance!