I'm attempting to build a balanced robot using the MPU6050 gyro and the DMP code by Jeff Rowberg. The right servo works fine but the left will not. I need to reverse its direction and I'm just negating the value I use for the right servo. However the left runs flat out and I don't understand why. The values are correct, just the negative of the right but the left servo will not change speed even I turn the gyro upside down. Help and suggestings is greatly appreciated. Thanks.
The code snippet:
OUTPUT_READABLE_YAWPITCHROLL
// display Euler angles in degrees
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
int routVal = (ypr[1] * 180/M_PI) + 90; //Get right servo value.
int loutVal = 90 - routVal; //Get left servo value.
Serial.print(routVal);
Serial.print(loutVal);
myservoL.write(loutVal);
myservoR.write(routVal);
EDIT: Never mind. I changed "90 - loutVal" to "180 - loutVal" and it now works. My brain was upside down.