Reading from multiple MPU 6050s

Hi I’m trying to set up two MPU 6050’s on an Arduino Uno board. I have it working with one with the following code which I found on the Arduino website:

// MPU-6050 Short Example Sketch
// By Arduino User JohnChi
// August 17, 2014
// Public Domain
const int MPU_addr=0x68; // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
void setup(){
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
void loop(){
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.requestFrom(MPU_addr,14,true); // request a total of 14 registers<<8|; // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)<<8|; // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)<<8|; // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)<<8|; // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)<<8|; // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)<<8|; // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)<<8|; // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
Serial.print("AcX = “); Serial.print(AcX);
Serial.print(” | AcY = “); Serial.print(AcY);
Serial.print(” | AcZ = “); Serial.print(AcZ);
Serial.print(” | Tmp = “); Serial.print(Tmp/340.00+36.53); //equation for temperature in degrees C from datasheet
Serial.print(” | GyX = “); Serial.print(GyX);
Serial.print(” | GyY = “); Serial.print(GyY);
Serial.print(” | GyZ = "); Serial.println(GyZ);

I’m wondering how I should alter it so that I can read in from both MPU 6050s. Thanks

The MPU6050 has a pin that can be used to select from two different device addresses, or as a device select. The data sheet has the details.

Yeah, don’t cross-post, and use CODE TAGS