Is it possible to connect more than one I2C device to an Arduino Uno? I know that the SCL and SDA pins are on analog pins A4 and A5 respectively, but there are also two pins labeled SCL and SDA located next to the AREF pin on the other side of the board. Does that mean I can connect multiple devices to the same board and, if so, how?
For context, I'm currently working on creating a robotic arm that matches its movements to the movements of my arm (I believe this is called a telepresence robot). To do so, I wanted to use a couple of IMUs (specifically the MPU-6050) to record the movements of my wrist and shoulder. Using the TinyMPU6050 library by Gabriel Milan, I've already been able to establish communication with one IMU, but I'm struggling with the second one. I'm already communicating with the arm via the Uno's SPI interface so I can't use that to communicate with a second IMU, although I know it's possible.
I know that similar questions have been asked before, but none of the questions I could find had the exact answers that I needed, so I thought I would ask anyway. This code that I currently have works for one IMU, but I don't know where to begin to add a second one (if it's even possible). Any help that I can get would be greatly appreciated. Cheers!
#include <TinyMPU6050.h>
MPU6050 IMU_1(Wire);
void setup() {
Serial.begin(9600);
//initializing and calibrating `IMU_1`
IMU_1.Initialize();
Serial.println("Calibrating...");
IMU_1.Calibrate();
Serial.println("Calibrated");
while (!Serial) {
//empty while loop
}
}
void loop() {
IMU_1.execute();
Serial.println();
Serial.print("X angle = ");
Serial.println(IMU_1.GetAngX());
Serial.print("Y angle = ");
Serial.println(IMU_1.GetAngY());
Serial.print("Z angle = ");
Serial.println(IMU_1.GetAngZ());
delay(1000);
}