I want to use both IMU at the same time using the Sparkfun Library on a SAMD21 mini breakout board. Can anyone help?

The begin function is :

inv_error_t MPU9250_DMP::begin(void) {
  inv_error_t result;
  struct int_param_s int_param;
  result = mpu_init(&int_param);
  if (result)
    return result;
  mpu_set_bypass(1); // Place all slaves (including compass) on primary bus
  _gSense = getGyroSens();
  _aSense = getAccelSens();
  return result;
  • 1
    Have you tried to do it? May 12, 2017 at 9:13
  • yes i tried but when connecting them togher i got the same data for both,actually i'm trying to modify the library to have to imu with two adresse 0x68 and 0x69
    – samibe
    May 12, 2017 at 9:26
  • I have the same problem now. the function is burried in 3rd lvl of libraries.. Where did you change the code? Nov 16, 2017 at 14:53

1 Answer 1


Sorry, but I'm not 100% sure of what you are trying to do, I don't understand 'both imu the' in your question. I think you are trying to use two identical boards at the same time. (If not tell me so I can edit my answer)

You will need to modify the library so the begin function takes a parameter. That parameter for MPU9250_DMP::begin then identifies the address of the device, this will need passing to Wire.begin() I think (you'll need to check the Wire.begin() function, I can't).

That should let you create two different instances of the class.

MPU9250_DMP apple;
MPU9250_DMP banana;
  • yes i want to use this but in the begin function there is no parameter to pass
    – samibe
    May 12, 2017 at 10:11
  • Erm, whoops, I missed a line out of the answer. You need to change the library so begin() takes a parameter. Sorry for the confusion. May 12, 2017 at 10:18
  • thank you, i'm trying to modify it, now i'll test it and i'll give you the response
    – samibe
    May 12, 2017 at 10:25
  • i changed the library,the problem is there is no data displayed ,when debugging even when i Print Something in the serial nothing displayed
    – samibe
    May 12, 2017 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.