TFT 2.4 MCUFriend goto blank white every use Max30100

Hi friend,

I have issue with TFT 2.4. I dont know why every i'm get value heart rate & sp02 sensor Max30100( pox.update() ), tft goto blank white.

I try example MCUFRIEND_kbv>graphictest_kbv only => tft 100% working perfect.
I try example max30100lib>MAX30100_minimal only => sensor heart rate & sp02 100% working perfect.

Then, i try to join sketch tft & max30100 void setup() working perfect but after void loop() tft always blank white. :frowning:

I try to comment //pox.update(); and the result success tft working perfect but we know sensor cannot get value heart rate & sp02 because pox.update(); condition is comment //.

this is my sketch:

#include <Wire.h>
#include <MAX30100_PulseOximeter.h>
#include <Adafruit_GFX.h> 
#include <MCUFRIEND_kbv.h>

MCUFRIEND_kbv tft;
#define LCD_CS A3 
#define LCD_CD A2 
#define LCD_WR A1 
#define LCD_RD A0 
#define LCD_RESET A4
//MCUFRIEND_kbv tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);


#define BLACK   0x0000
#define RED     0xF800
#define GREEN   0x07E0
#define WHITE   0xFFFF
#define GREY    0x8410

#define REPORTING_PERIOD_MS     1000
PulseOximeter pox;
 
uint32_t tsLastReport = 0;
 

void onBeatDetected()
{
    Serial.println("Beat!");
}

void showmsgXY(int x, int y, int sz, const GFXfont *f, const char *msg)
{
    int16_t x1, y1;
    uint16_t wid, ht;
    //tft.drawFastHLine(0, y, tft.width(), WHITE);
    tft.setFont(f);
    tft.setCursor(x, y);
    tft.setTextColor(GREEN);
    tft.setTextSize(sz);
    tft.print(msg);
    //delay(1);
}

void setup()
{
    Serial.begin(115200);
    //Serial.begin(9600);
    Serial.print("Initializing pulse oximeter..");

    if (!pox.begin()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
    }
    //pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
    pox.setOnBeatDetectedCallback(onBeatDetected);

    uint16_t ID = tft.readID();
    //if (ID == 0xD3) ID = 0x9481;
    tft.begin(ID);
    tft.setRotation(0);
    tft.fillScreen(BLACK);
    showmsgXY(20, 10, 1, NULL, "welcome test max30100");
}
 
void loop()
{
    ////////////////////////////////
    pox.update(); //<<<<<<< if we comment pox.update(); tft not white blank.
    ////////////////////////////////
    
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
        //Serial.print("Heart rate:");
        //Serial.print(pox.getHeartRate());
        //Serial.print("bpm / SpO2:");
        //Serial.print(pox.getSpO2());
        //Serial.println("%");
        showmsgXY(20, 10, 1, NULL, pox.getHeartRate());
        showmsgXY(20, 24, 2, NULL, pox.getSpO2());        
    
        tsLastReport = millis();
    }
}

anyone have idea to solve my case?

thank's.

bulti.

MAX30100 is an I2C device. SDA is on A4 of a Uno. TFT_RST is also on A4.

You must either make a hardware mod to your shield.
Or use a different Arduino with separate pins.

David.