Even after updating my I2C library like StrayVoltage suggested in#35, the sketch does not converge for me.
I think I've found the underlying problem in my setup: setXGyroOffset (and the Y,Z functions too) cannot handle negative inputs.
In my code, I declare:
But then when I read them out with
-1 ; -1; -1 ; 63 ; 63 ; 63
That is, the accelerometer is able to handle negative inputs, but the Gyroscope functions freak out and change -1 to 63. I think this has to do with negative representation (63 = 111111 in binary) but what's odd is that 64 is a 6 bit number, not 8 or 16
That's why my sketch doesn't converge. It seems like the sketch is trying to add negative numbers when the readings are positive, so that the sum is 0.
But instead of adding a negative number, it is positive; thus the indefinite cycling.
I am looking into how to fix this, but my programming background is still crappy:
edited to add my system:
I'm using a Teensy 3.2 with the SparkFun 9150 breakout board, with both the old and new I2C dev libraries. ( I need to comment out Wire.h in my calibration.ino code because of conflicting libraries)
I still see the same problem when I use my Arduino Uno instead of the Teensy