Esp32_ili9341 got white screen problem

Hi all.
I have checked quite a few of similar topic here and there, didn't see a reasonable solution yet.
my ESP32_ILI9341 works well for TFT_eSPI's examples, but got white screen for the code below, it's why I guess something wrong of code?
Thanks for help.
Adam

#include <Wire.h>
#include <TinyGPS++.h>
#include "SPI.h"
#include <TFT_eSPI.h>

TFT_eSPI tft = TFT_eSPI();       // Invoke custom library


#define RXD2 16
#define TXD2 17
HardwareSerial neogps(1);

TinyGPSPlus gps;

void setup() {
  //  SerialSetting();
  //  TFTsetting();

  Serial.begin(115200);
  tft.init();
  tft.fillScreen(TFT_BLACK);
  neogps.begin(9600, SERIAL_8N1, RXD2, TXD2);
  delay(2000);

}

void loop() {

  boolean newData = false;
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (neogps.available())
    {
      if (gps.encode(neogps.read()))
      {
        newData = true;
      }
    }
  }

  //If newData is true
  if (newData == true)
  {
    newData = false;
    Serial.println(gps.satellites.value());
    print_speed();
  }
  else
  {

    tft.fillScreen(TFT_BLACK);
    tft.setTextColor(TFT_GREEN);
    tft.setCursor(0, 0);
    tft.setTextSize(3);
    tft.print("No Data");

  }

}

I've find out that // neogps.begin(9600, SERIAL_8N1, RXD2, TXD2); commented this line, no white screen, but don't know why?

Have you tried the Adafruit_ILI9341 library?

1 Like

Thanks.
the Adafruit_ILI9341 library's example works well. I'll put GPS in and see?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.