I have a 3.95" tft and it reports that it is an ili9488 using readID.
I am using it with an UNO R3 and have the MCUFRIEND_kbv and TouchScreen classes
I can get the touch working or I can update the screen in the loop but I cannot get both working at the same time. Code below.
The reason for the guard clause is I don't want the screen constantly flashing with updates.
if I comment out the line to getPoint then the screen will update the clock time. If I leave the getPoint then I can get the point information but the screen will not update the clock.
Can someone point me in the appropriate direction to get this working?
Thanks,
int i=0;
void loop()
{
if(i == 55000)
{
generateTimeDisplay();
i=-1;
}
i++;
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
TSPoint p = ts.getPoint();
digitalWrite(13, LOW);
}
char bufback[32] = {""};
void generateTimeDisplay()
{
// prepare the new text to display
time_t ptm = now();
char buf[32];
snprintf(buf, 32, "%.2d/%.2d/%d %.2d:%.2d:%.2d", month(ptm),day(ptm),year(ptm),hour(ptm),minute(ptm),second(ptm));
// clear the old text from the screen
tft.setCursor(50,80);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.println(bufback);
// put the new text on screen
tft.setCursor( 50, 80);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.println(buf);
// set the back buffer to the current text
snprintf(bufback, 32, "%.2d/%.2d/%d %.2d:%.2d:%.2d", month(ptm),day(ptm),year(ptm),hour(ptm),minute(ptm),second(ptm));
}