I am trying to print the angles from an MPU 6050 onto a TFT screen using the Jeff Rowrberg library. There is one line that when i comment out, the TFT screen works like normal but with it in place, the TFT does not print anything. Here is the main function, and I've also attached the whole code.
void loop() {
if (!dmpReady) return;
while (!mpuInterrupt && fifoCount < packetSize) {
}
mpuInterrupt = false;
mpuIntStatus = mpu.getIntStatus();
fifoCount = mpu.getFIFOCount();
if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
mpu.resetFIFO();
} else if (mpuIntStatus & 0x02) {
while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
mpu.getFIFOBytes(fifoBuffer, packetSize);
fifoCount -= packetSize;
mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); //THIS IS THE LINE THAT MAKES THE TFT NOT WORK
tft.fillScreen(RED);
tft.drawRect(0,0,319,240,YELLOW);
tft.setCursor(38,80);
tft.setTextColor(BLACK);
tft.setTextSize(3);
tft.print(ypr[0] * 180/M_PI);
Serial.print("y\t");
Serial.print(ypr[0] * 180/M_PI);
Serial.print("\n");
}
raaw.ino (4.54 KB)