Jump to content
I2Cdevlib Forums

double MPU6050 (Sparkfun)

Recommended Posts



I connected 2 MPU6050's and 2 MMA8452's to a Arduino Fio. I'm using the DMP for the 6050's.


Altering the example code for the MMA8452 to adress them at different adresses was not that difficult. I adapted the functions to pass the device adress.


The example code for the MPU6050 is a lot bigger and complexer so I was wondering how I could pass the device address as a global variable. Tried some, but compiler keeps on protesting. Has someone experience with this??


Greetings, Pamela

Link to comment
Share on other sites

Just an addition..


First I tried to use the specific address constructor in mpu6050.cpp


In my sketch it says:



MPU6050 mpu;



// actions for MPU at high address



// actions for MPU at low address


Link to comment
Share on other sites

Hi pammie,


This would be much easier if you create two instances of the device:

MPU6050 mpu1(MPU6050_ADDRESS_AD0_LOW);
MPU6050 mpu2(MPU6050_ADDRESS_AD0_HIGH);
Then simply use them as independent objects. The device constructor is meant to take the slave address as an optional parameter for this purpose.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...