Show Posts
Pages: [1]
1  Using Arduino / Sensors / L3G4200D gyroscope on: January 18, 2013, 03:29:40 pm
Hi guys,

I am trying to hook up a L3G4200D gyroscope with an Arduino UNO system. I found some code online that is specific for this gyroscope but am having some difficulties. I can't seem to get an output other than "000". I think there is a problem with the I2C communication between the the gyro and Arduino but I am not sure. Does anyone know what might be the problem with our code or something we could try to fix our problem.

The code we are using is below:
#define GYROSCOPE 0x69
#include <L3G.h>
#include <Wire.h>

L3G gyro;
int x, y, z;
int L3G4200D_Address = 107;
byte buff[6];

void setup() {
 if (!gyro.init(L3G4200D_DEVICE, L3G_SA0_LOW))
    Serial.println("Failed to autodetect gyro type!");
    while (1);


void loop() {
    // Delay the flow
    int i = 0;
    while(Wire.available()) {
       buff[i] =;
    // Convert to ints
    x = (((int)buff[1]) << 8) | buff[0];  
    y = (((int)buff[3]) << 8) | buff[2];
    z = (((int)buff[5]) << 8) | buff[4];
    Serial.print(" ");
    Serial.print(" ");

Pages: [1]