Scrolling example on an ILI9488 display with teensy 4.1

lsrichard

Active member
I was trying out the scrollTest example that is part of the ILI9488_t3 library and it generated color bars as soon as the text gets to the bottom of the screen.
Attached is a photo.
I am new to coding but usually can get an example to work right.
The button is just to test the touch screen.
bestILI9488resize.jpg
 
Maybe its scrolling the wrong direction? Maybe there's an interaction with any reflection settings?
 
Maybe its scrolling the wrong direction? Maybe there's an interaction with any reflection settings?
Yes, I tried all 4 directions on this and it did the same thing.
I think I may have a fundamental misunderstanding of how scrolling works on this display.
The bottom line works and updates correctly.
I may be able to think of a way to go around this problem.
 
It has been awhile since I looked at that sketch.
I don't remember if all/most of these displays support the MISO pin, to be able to read the contents of the memory back, to then output...
Or if that was required on these chips as there may be some support into them... @mjs513 do you remember
 
It has been awhile since I looked at that sketch.
I don't remember if all/most of these displays support the MISO pin, to be able to read the contents of the memory back, to then output...
Or if that was required on these chips as there may be some support into them... @mjs513 do you remember

You are right. Not all of the displays can actually read the display pixels. So if it can't read the previous pixels it won't work correctly and give you want you are seeing.

Other possibilty is that you are running into an issue with using touch at the same time. There are issues with some of these boards where the miso lines dont work correctly if you have more than one device attached.
 
You are right. Not all of the displays can actually read the display pixels. So if it can't read the previous pixels it won't work correctly and give you want you are seeing.
Actually I may be wrong... I have not played much with the Scrolling stuff, built into the chip itself.

That is command 33h
1773942944474.png

Note the description continues for about the next 3 pages in the PDF...

And then there is Command 37h
1773943112163.png


Which also continues on the next page:

Looking at the sources, I don't see anywhere that sets up the rectangle 0x33? I may be missing it. But I don't think any of this code
has changed in maybe 7 years.
 
I have a few of the ILI9488 displays and always have had to leave the MISO disconnected for it to work at all.
I know it will not be possible to read from the display without it.
I think this is one of those displays you cannot read from.
The touch screen code was added later after I was already having the color bars problem.

For now I have a work around for this where I make the scroll box small ( just the bottom line ).
I know its not really scrolling but at least I do not need to erase the bottom line all the time
Here is my modified code for the scrollTest example.

C++:
```cpp
/***************************************************
  This is our GFX example for the Adafruit ILI9488 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <SPI.h>
#include <ILI9488_t3.h>
#include <ILI9488_t3_font_ComicSansMS.h>
#include <XPT2046_Touchscreen.h>
#define TEENSY64

// Define the SPI clock frequency, this affects the graphics rendering speed. Too
// fast and the TFT driver will not keep up and display corruption appears.
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
// With an ILI9163 display 27 MHz works OK.

// #define SPI_FREQUENCY   1000000// different spi frequencys did not help
// #define SPI_FREQUENCY   5000000
// #define SPI_FREQUENCY  10000000
// #define SPI_FREQUENCY  20000000
//#define SPI_FREQUENCY  27000000
// #define SPI_FREQUENCY  40000000
// #define SPI_FREQUENCY  55000000 // STM32 SPI1 only (SPI2 maximum is 27MHz)
// #define SPI_FREQUENCY  80000000

// Optional reduced SPI frequency for reading TFT
//#define SPI_READ_FREQUENCY  20000000

// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here:
//#define SPI_TOUCH_FREQUENCY  2500000

// For the Adafruit shield, these are the default.
#if defined(__MK66FX1M0__) && !defined(TEENSY64)// needs this
//#define TFT_RST 8
//#define TFT_DC 9
//#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)// needs this
// On Teensy 4 beta with Paul's breakout out:
// Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
// which are not in the Normal processor positions
// Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
//#elif defined(TEENSY64)
//#define TFT_RST 255
//#define TFT_DC 20
//#define TFT_CS 21
//#define TFT_SCK 14
//#define TFT_MISO 39
//#define TFT_MOSI 28
//ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
#else
#error "This example App will only work with Teensy 3.6 or Teensy 4."
#endif
// If using the breakout, change pins as desired
//Adafruit_ILI9488 tft = Adafruit_ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

#define CS_PIN  20// for touch screen
//#define SCLK_PIN 8 //8 was 2// Must be 8 for Hardware SPI XIAO
//#define MOSI_PIN 10 //10 was 3// Must be 10 for hardware SPI XIAO// Pin 9 is MISO
// MOSI=11, MISO=12, SCK=13 on others
//XPT2046_Touchscreen ts(CS_PIN);
#define TIRQ_PIN  2// for touch screen
//XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, 255);  // Param 2 - 255 - No interrupts
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);  // Param 2 - Touch IRQ Pin - interrupt enabled polling

void setup() {
  Serial.begin(9600);
  ts.begin();
  ts.setRotation(1);
  tft.begin();
  tft.setRotation(1);// was 3
  tft.fillScreen(ILI9488_BLACK);
  while (!Serial) ;// serial monitor must be activated
  //tft.useFrameBuffer(true); // this makes it get stuck
  tft.enableScroll();
  //tft.setScrollTextArea(0,282,479,42);// if you want the color bars back.
  tft.setScrollTextArea(0,302,479,22);// if last number is higher than 22 there will be color bars.
  //tft.useFrameBuffer(true); // this makes it get stuck
  tft.setScrollBackgroundColor(ILI9488_BLACK);
  tft.setCursor(280, 200);
  tft.setFont(ComicSansMS_12);
  tft.setTextSize(2);
  tft.print("Fixed text");

  tft.setTextColor(ILI9488_YELLOW);
  tft.setCursor(0, 0);
  for(int i=0;i<14;i++){// lines 0 to 13 fit on normal screen
    tft.print("  this is line ");
    tft.println(i);
    delay(500);
  }// for

  tft.setCursor(0,304);// set cursor for scroll area

  for(int i=14;i<29;i++){
    tft.print("  this is line ");
    tft.println(i);
    delay(500);
  }// for

  for(int i=0;i<20;i++){
    tft.print("  this is line ");
    tft.println(i);
    delay(500);
  }// for

  tft.fillRoundRect(320 ,0 , 160, 54, 10, ILI9488_PURPLE);// push button
  tft.drawRoundRect(320 ,0 , 160, 54, 10, ILI9488_YELLOW);
  tft.setCursor(330, 20);
  tft.setTextColor(ILI9488_WHITE);
  tft.println(" Touch ");

  tft.setCursor(0, 304);// set cursor for scroll area // all new text will print on the bottom line as long as there is a tft.println() // no need to clear line.
  tft.setTextColor(ILI9488_YELLOW);
}// setup

void loop(void) {
  if (ts.touched()) {
    TS_Point p = ts.getPoint();// read touch screen
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(30);
    Serial.println();
    if((p.x > 235) && (p.x < 1440)) {// number ranges adjusted for this touch screen
        if ((p.y > 3300) && (p.y <= 3885)) {// number ranges adjusted for this touch screen
          Serial.println("Button pushed");
          tft.print("Button pushed: ");
          tft.print("Pressure = ");
          tft.print(p.z);
          tft.print(", x = ");
          tft.print(p.x);
          tft.print(", y = ");
          tft.println(p.y);// no need to clear line as long as there is a tft.println()
          delay(30);// makes it less flickery
        }//p.y
      }//p.x
  }//touch
}//loop

```
 
I have completely fixed the scrolling problem I was having.
I found an other ScollTest example for the ST7735_t3 library that had the proper use of the frame buffer in it.
All that was needed was to enable the frame buffer before the scroll enable then do an update screen after every println.
Now that this is working properly I hope to turn this into a stand alone serial monitor and/or a MIDI serial monitor.

C++:
```cpp
/***************************************************
  This is our GFX example for the Adafruit ILI9488 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <SPI.h>
#include <ILI9488_t3.h>
#include <ILI9488_t3_font_ComicSansMS.h>
#include <XPT2046_Touchscreen.h>
#define TEENSY64

// For the Adafruit shield, these are the default.
#if defined(__MK66FX1M0__) && !defined(TEENSY64)// needs this
//#define TFT_RST 8
//#define TFT_DC 9
//#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)// needs this
// On Teensy 4 beta with Paul's breakout out:
// Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
// which are not in the Normal processor positions
// Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
//#elif defined(TEENSY64)
//#define TFT_RST 255
//#define TFT_DC 20
//#define TFT_CS 21
//#define TFT_SCK 14
//#define TFT_MISO 39
//#define TFT_MOSI 28
//ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
#else
#error "This example App will only work with Teensy 3.6 or Teensy 4."
#endif
// If using the breakout, change pins as desired
//Adafruit_ILI9488 tft = Adafruit_ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

#define CS_PIN  20// for touch screen
//#define SCLK_PIN 8 //8 was 2// Must be 8 for Hardware SPI XIAO
//#define MOSI_PIN 10 //10 was 3// Must be 10 for hardware SPI XIAO// Pin 9 is MISO
// MOSI=11, MISO=12, SCK=13 on others
//XPT2046_Touchscreen ts(CS_PIN);
#define TIRQ_PIN  2// for touch screen
//XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, 255);  // Param 2 - 255 - No interrupts
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);  // Param 2 - Touch IRQ Pin - interrupt enabled polling

void setup() {
  Serial.begin(9600);
  ts.begin();
  ts.setRotation(1);
  tft.begin();
  tft.setRotation(1);// was 3
  tft.fillScreen(ILI9488_BLACK);
  while (!Serial) ;// serial monitor must be activated
  tft.useFrameBuffer(true); // this actually works now but tft.updateScreen(); needs to be after every tft.println();
  tft.enableScroll();
  tft.setScrollTextArea(0,58,479,262);
  tft.setScrollBackgroundColor(ILI9488_BLACK);
  tft.setCursor(160, 20);
  tft.setFont(ComicSansMS_12);
  tft.setTextSize(2);
  tft.print("Fixed text");// default text color is white
  tft.setTextColor(ILI9488_YELLOW);
  tft.setCursor(0, 60);
  for(int i=0;i<30;i++){
    tft.print("  this is line ");
    tft.println(i);// scrolling working now
    tft.updateScreen();
    delay(500);
  }// for

  for(int i=0;i<20;i++){
    tft.print("  this is line ");
    tft.println(i);
    tft.updateScreen();
    delay(500);
  }// for

  tft.fillRoundRect(320 ,0 , 160, 54, 10, ILI9488_PURPLE);// push button
  tft.drawRoundRect(320 ,0 , 160, 54, 10, ILI9488_YELLOW);
  tft.setCursor(330, 20);
  tft.setTextColor(ILI9488_WHITE);
  tft.println(" Touch ");
  tft.updateScreen();

  tft.setCursor(0, 304);// set cursor for scroll area // all new text will print on the bottom line as long as there is a tft.println() // no need to clear line.
  tft.setTextColor(ILI9488_YELLOW);
}// setup

void loop(void) {
  if (ts.touched()) {
    TS_Point p = ts.getPoint();// read touch screen
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(30);
    Serial.println();
    if((p.x > 235) && (p.x < 1440)) {// number ranges adjusted for this touch screen
        if ((p.y > 3300) && (p.y <= 3885)) {// number ranges adjusted for this touch screen
          Serial.println("Button pushed");
          tft.print("Button pushed: ");
          tft.print("Pressure = ");
          tft.print(p.z);
          tft.print(", x = ");
          tft.print(p.x);
          tft.print(", y = ");
          tft.println(p.y);
          tft.updateScreen();
          delay(30);
        }//p.y
      }//p.x
  }//touch
}//loop

```
 
Works on ST7796_t3 for nice scrolling too!
It has unique touch - EDITED - it has no pressure so counted button presses, changed display wait times, edited button coords.
Code:
// https://forum.pjrc.com/index.php?threads/scrolling-example-on-an-ili9488-display-with-teensy-4-1.77766/post-366708

/***************************************************
  This is our GFX example for the Adafruit ILI9488 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <SPI.h>

#include "ST7796_t3.h"
#include <font_ComicSansMS.h>
#include <Adafruit_FT6206.h>
#define TEENSY64
const int LCD_CS_PIN = 10;
const int LCD_DC_PIN = 9;
ST7796_t3 tft = ST7796_t3(LCD_CS_PIN, LCD_DC_PIN);
Adafruit_FT6206 ts = Adafruit_FT6206();


void setup() {
  Serial.begin(9600);
  tft.init(320, 480);         // Create tft object for use with Tetris
  tft.setRotation(3);         // Landscape
  tft.invertDisplay(true);    // Invert colors so that they are correct
  tft.fillScreen(0x0000);

  ts.begin(40);              // Touch used with Tetris
  while (!Serial) ;// serial monitor must be activated
  tft.useFrameBuffer(true); // this actually works now but tft.updateScreen(); needs to be after every tft.println();
  tft.enableScroll();
  tft.setScrollTextArea(0,58,479,262);
  tft.setScrollBackgroundColor(ST7735_BLACK);
  tft.setCursor(160, 20);
  tft.setFont(ComicSansMS_12);
  tft.setTextSize(2);
  tft.print("Fixed text");// default text color is white
  tft.setTextColor(ST7735_YELLOW);
  tft.setCursor(0, 60);
  for(int i=0;i<30;i++){
    tft.print("  this is line ");
    tft.println(i);// scrolling working now
    tft.updateScreen();
    delay(50);
  }// for

  for(int i=0;i<20;i++){
    tft.print("  this is line ");
    tft.println(i);
    tft.updateScreen();
    delay(10);
  }// for

  tft.fillRoundRect(320 ,0 , 160, 54, 10, ST7735_CYAN);// push button
  tft.drawRoundRect(320 ,0 , 160, 54, 10, ST7735_YELLOW);
  tft.setCursor(330, 20);
  tft.setTextColor(ST7735_WHITE);
  tft.println(" Touch ");
  tft.updateScreen();

  tft.setCursor(0, 304);// set cursor for scroll area // all new text will print on the bottom line as long as there is a tft.println() // no need to clear line.
  tft.setTextColor(ST7735_YELLOW);
}// setup

void loop(void) {
  static uint32_t aCnt=0;
  if (ts.touched()) {
    TS_Point p = ts.getPoint();// read touch screen
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(10);
    Serial.println();
    if ((p.x <= 64)) {// number ranges adjusted for this touch screen
        if (p.y <= 160) {// number ranges adjusted for this touch screen
          Serial.println("Button pushed");
          tft.print("Button pushed: ");
          tft.print("CNT = ");
          tft.print(++aCnt);
          tft.print(", x = ");
          tft.print(p.x);
          tft.print(", y = ");
          tft.println(p.y);
          tft.updateScreen();
          delay(30);
        }//p.y
      }//p.x
  }//touch
}//loop
 
Last edited:
I also found a command that will let you force the scrolling.
tft.scrollTextArea(5);
I used this to create a smoother crawl up the screen even before the text gets to the bottom.

C++:
```cpp
 This is our GFX example for the Adafruit ILI9488 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <SPI.h>
#include <ILI9488_t3.h>
#include <ILI9488_t3_font_ComicSansMS.h>
#include <XPT2046_Touchscreen.h>
#define TEENSY64

// For the Adafruit shield, these are the default.
#if defined(__MK66FX1M0__) && !defined(TEENSY64)// needs this
//#define TFT_RST 8
//#define TFT_DC 9
//#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)// needs this
// On Teensy 4 beta with Paul's breakout out:
// Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
// which are not in the Normal processor positions
// Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
//#elif defined(TEENSY64)
//#define TFT_RST 255
//#define TFT_DC 20
//#define TFT_CS 21
//#define TFT_SCK 14
//#define TFT_MISO 39
//#define TFT_MOSI 28
//ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
#else
#error "This example App will only work with Teensy 3.6 or Teensy 4."
#endif
// If using the breakout, change pins as desired
//Adafruit_ILI9488 tft = Adafruit_ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

#define CS_PIN  20// for touch screen
//#define SCLK_PIN 8 //8 was 2// Must be 8 for Hardware SPI XIAO
//#define MOSI_PIN 10 //10 was 3// Must be 10 for hardware SPI XIAO// Pin 9 is MISO
// MOSI=11, MISO=12, SCK=13 on others
//XPT2046_Touchscreen ts(CS_PIN);
#define TIRQ_PIN  2// for touch screen
//XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, 255);  // Param 2 - 255 - No interrupts
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);  // Param 2 - Touch IRQ Pin - interrupt enabled polling

void setup() {
  Serial.begin(9600);
  ts.begin();
  ts.setRotation(1);
  tft.begin();
  tft.setRotation(1);// was 3
  tft.fillScreen(ILI9488_BLACK);
  //while (!Serial) ;// serial monitor must be activated
  tft.useFrameBuffer(true); // this actually works now but tft.updateScreen(); needs to be after every tft.println();//screen will stay blank until update screen
  tft.enableScroll();
  tft.setScrollTextArea(0,58,479,262);
  tft.setScrollBackgroundColor(ILI9488_BLACK);
  tft.setCursor(160, 20);// outside of scroll area
  tft.setFont(ComicSansMS_12);
  tft.setTextSize(2);
  tft.print("Fixed text");// default text color is white
  tft.setTextColor(ILI9488_YELLOW);
  tft.setCursor(0, 60);//set cursor for top of scroll area // must be within scroll area
  for(int i=0;i<12;i++){
    tft.print("  this is line ");
    tft.println(i);// scrolling working now
    tft.scrollTextArea(5);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    //delay(10);//update screen is slow and slows it down enough
    tft.scrollTextArea(6);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    tft.scrollTextArea(5);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    tft.scrollTextArea(6);// force scroll up by set number// results in smooth scrolling until it gets to bottom
    tft.updateScreen();//screen will stay blank until update screen
  }// for
  for(int i=0;i<11;i++){// scroll until 11 rolls off top of screen
    tft.scrollTextArea(5);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    tft.scrollTextArea(6);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    tft.scrollTextArea(5);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
    tft.scrollTextArea(6);// force scroll up by set number
    tft.updateScreen();//screen will stay blank until update screen
  }// for

  for(int i=0;i<20;i++){
    tft.print("  this is line ");
    tft.println(i);
    tft.updateScreen();
    //delay(500);
    delay(400); //update screen is slow and slows it down some
  }// for

  tft.fillRoundRect(320 ,0 , 160, 54, 10, ILI9488_PURPLE);// push button
  tft.drawRoundRect(320 ,0 , 160, 54, 10, ILI9488_YELLOW);
  tft.setCursor(330, 20);// outside of scroll area
  tft.setTextColor(ILI9488_WHITE);
  tft.println(" Touch ");
  tft.updateScreen();

  tft.setCursor(0, 304);// set cursor for scroll area on bottom line// must be within scroll area
  tft.setTextColor(ILI9488_YELLOW);
}// setup

void loop(void) {
  if (ts.touched()) {
    TS_Point p = ts.getPoint();// read touch screen
    Serial.print("Pressure = ");
    Serial.print(p.z);
    Serial.print(", x = ");
    Serial.print(p.x);
    Serial.print(", y = ");
    Serial.print(p.y);
    delay(10);
    Serial.println();
    if((p.x > 235) && (p.x < 1440)) {// number ranges adjusted for this touch screen
        if ((p.y > 3300) && (p.y <= 3885)) {// number ranges adjusted for this touch screen
          Serial.println("Button pushed");
          tft.print("Button pushed: ");
          tft.print("Pressure = ");
          tft.print(p.z);
          tft.print(", x = ");
          tft.print(p.x);
          tft.print(", y = ");
          tft.println(p.y);
          tft.updateScreen();
          //delay(10);// no delay needed slow enough allready
        }//p.y
      }//p.x
  }//touch
}//loop

```
 
Yes, it is all determined by the tft.setCursor command.
if it is within the scroll area then it can scroll.
In the example I print the touch button in the static area then go back to the scroll area tft.setCursor(0, 304); on the bottom line.
You may need to add a tft.println(); to make sure it will not over print the last line.
 
There is a tft.updateScreenAsync(); command you could try but I do not now how to use it.
It is probably used with other commands like waitUpdateAsyncComplete();
endUpdateAsync();
asyncUpdateActive();
I do not know how any of these are used.
I just found them on the ILI9488_t3 keyword list.
 
Back
Top