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?