I'm using a GY80 with an Arduino Due for a quadcopter project, which has a L3G4200D gyroscope. I've been trying to calculate pitch and roll but I just noticed something I'm not sure is correct. Basically the values for the gyroscope never go below zero. I though it was supposed to be positive values for clockwise rotation and negative values for anti-clockwise.
Below is a sample bit of code. I'm using the I2Cdev arduino library.
#include <Wire.h>
#include <I2Cdev.h>
#include <L3G4200D.h>
L3G4200D gyro;
int16_t gyroX, minVal;
void setup() {
Wire.begin();
Serial.begin(115200);
gyro.initialize();
gyro.setFullScale(2000);
}
void loop() {
gyroX = gyro.getAngularVelocityX();
minVal = min(minVal, gyroX);
Serial.print("Raw: "); Serial.print(gyroX);
Serial.print(" Min: "); Serial.println(minVal);
}
Is this working correctly? Am I doing something wrong?