-
-
Save GiovanniBalestrieri/5a259bce2629eb1b01ee to your computer and use it in GitHub Desktop.
Gyroscope Matlab and Arduino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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