Skip to content

Instantly share code, notes, and snippets.

@GiovanniBalestrieri
Created August 11, 2015 23:22
Show Gist options
  • Save GiovanniBalestrieri/5a259bce2629eb1b01ee to your computer and use it in GitHub Desktop.
Save GiovanniBalestrieri/5a259bce2629eb1b01ee to your computer and use it in GitHub Desktop.
Gyroscope Matlab and Arduino
void setup()
{
Wire.begin();
Serial.begin(57600);
Serial.println("starting up L3G4200D");
// Configure L3G4200 - 250, 500 or 2000 deg/sec
setupL3G4200D(2000);
delay(1500); //wait for the sensor to be ready
k = millis();
}
void loop()
{
// This will update x, y, and z with new values
getGyroValues();
serialRoutine();
}
void serialRoutine()
{
if(Serial.available()>0)
{
char t = Serial.read();
if (t =='T')
{
Serial.println("Ok");
}
else if (t== 'M')
{
#ifdef DEBUG
printTime();
#endif
printCSVomega();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment