Hi all,
Im very new to ECE and arduino :). Recently, I am trying to interface arduino uno with a pololu minimu v2 . I have run I2C scanner and it can recognize the device.
My code is as followed, taking the sample from pololu website:
#include <Wire.h>
#include <L3G.h>
#include <LSM303.h>
L3G gyro;
LSM303 compass;
void setup() {
Serial.begin(9600);
Wire.begin();
if (!gyro.init())
{
Serial.println("Failed to autodetect gyro type!");
while (1);
}
gyro.enableDefault();
compass.init();
compass.enableDefault();
}
void loop() {
gyro.read();
compass.read();
Serial.print((int)compass.a.x);
Serial.print(", ");
Serial.print((int)compass.a.y);
Serial.print(", ");
Serial.print((int)compass.a.z);
Serial.print(", ");
Serial.print((int)gyro.g.x);
Serial.print(", ");
Serial.print((int)gyro.g.y);
Serial.print(", ");
Serial.println((int)gyro.g.z);
delay(250);
}
Is this code enough to collect data? Should I perform any calibration?
Also, how to convert the "raw" reading into g and degree?
Thanks for your help