Skip to content

Instantly share code, notes, and snippets.

@GiovanniBalestrieri
Last active August 29, 2015 14:25
Show Gist options
  • Save GiovanniBalestrieri/3736318e069bc4487f88 to your computer and use it in GitHub Desktop.
Save GiovanniBalestrieri/3736318e069bc4487f88 to your computer and use it in GitHub Desktop.
Getting angular rate value from L3G4200D gyroscope and Arduino
void getGyroValues()
{
timerReading = micros() - dt;
byte xMSB = readRegister(L3G4200D_Address, 0x29);
byte xLSB = readRegister(L3G4200D_Address, 0x28);
x = ((xMSB << 8) | xLSB);
byte yMSB = readRegister(L3G4200D_Address, 0x2B);
byte yLSB = readRegister(L3G4200D_Address, 0x2A);
y = ((yMSB << 8) | yLSB);
byte zMSB = readRegister(L3G4200D_Address, 0x2D);
byte zLSB = readRegister(L3G4200D_Address, 0x2C);
z = ((zMSB << 8) | zLSB);
dt = micros();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment