I'm working on a project trying to obtain angle measurement from the above gyroscope/accelerometer. The relevant code is shown below (can add more if needed).
if (i % 15 == 0){
i = 0;
AxAVE = 0;
}
AcX=Wire.read()<<8|Wire.read();
AcX = abs(AcX);
AxAVE = abs(AxAVE);
AxAVE = abs(((abs(AxAVE))*(i) + (abs(AcX)))/(i+1));
Serial.print(AcX); Serial.print("\t");
Serial.print(AxAVE); Serial.print("\n");
i = i+1;
We get two columns of data; the left column is the raw input at one timepoint and the right column is the running average. When I move the gyro/accelero from 0 to 90 degrees, the left column changes appropriately, but the right column will change for about the first 2 time points and then return to the running averages at 0 degrees for all the next timepoints.