Multiple L3GD20 gyros connect to Arduino via I2C?

Is it possible to connect multiple gyros L3GD20 to Arduino via I2C connection? If yes, do I need to modify the library ?
Thank you


Yes, you can change the device address of the L3GD20 gyro to independently control up to two of them on a single I2C bus. You can learn more about how to do that under the “I2C Communication” section of the L3GD20’s product page.

We do not have an example sketch for controlling more than one L3GD20, but you will not have to modify our L3G library to create your own. I have written an example program below that demonstrates how the Serial example from the L3G library could be modified to display readings from two sensors (although I have not verified that it works):

#include <Wire.h>
#include <L3G.h>

L3G gyro1;
L3G gyro2;

char report[80];

void setup()
  gyro1.init(L3G::device_D20, L3G::sa0_high);
  gyro2.init(L3G::device_D20, L3G::sa0_low);

void loop()

  snprintf(report, sizeof(report), "gyro1 X: %6d Y: %6d Z: %6d  gyro2 X: %6d Y: %6d Z: %6d",
    (int)gyro1.g.x, (int)gyro1.g.y, (int)gyro1.g.z, 
    (int)gyro2.g.x, (int)gyro2.g.y, (int)gyro2.g.z);



Thank you so much Jon!

Hello khangn,

I wanted to know if you have use to complete your work or something different ? and if you can give some advice on that ? Because i’m workign on similar project but with two minimu-9.

Have a nice day.