println Horizontal Scroll on an MCUfriend TFT


I am using david_prentice "Mcufriend_kbv" library on a 3.6 inch MCUfriend TFT and it has an excellent vertical scroll.

However I would like to scroll with the TFT in landscape from bottom to top, which I assume must be a very common thing and natural thing to do, but cannot find a routine.

Have I missed a trick or is there an easy way to horizontal scroll print statements smoothly. I just cannot seem to do it with out screen fills etc which looks awful and slow.

Have googled and cannot seem to find a relevant answer.

I have a fairly simple requirement to repeatedly slowly scroll through about 40 println strings and each between 80-200 chars long


No, none of the controllers have a horizontal scroll. If that is what you want, you have to use Landscape mode.

I presume that you are using a 320x480 display. In Portrait mode you can get 40 lines of small text. I don't think that my eyes would enjoy the experience. e.g. 12x8 font.

In Landscape mode with the standard 7x5 font, you get 40 lines of 80 characters.

Scrolling that amount of screen in software would be painful but not impossible. Use readGRAM() into a buffer. Then use pushColors() to write it back. Your ILI9488 can do blocks of memory. An older controller can only read one pixel at a time.

It sounds fun. Tell me more about aspect, font, controller, ...


Hi David,

Thanks, I was hoping you would comment ...... I will look into your suggestions, may take me a couple of weeks.

The basis of what I am trying to do is very (very) simple - in effect scrolling through a page of data over and over again. you might recognise the underlying code below from Mcufriend_kbv examples, but is very crude :)

Obviously text is size 3 and statements wrap around the screen, so I only expect 3 to 4 statements on screen at any one time ( not all 40 statements) but then scroll through all 40 statements very slowly but smoothly. I just want to do something like the 'GROOP' example scroll but in horizontal mode.

identifier is reported as 0x9486.

Thanks so much - will get back after some trials , only been into TFT's 3 days :)

void setup() {

.... tft.setRotation(1);  //   set landscape so TFT looks like a monitor 480 wide x  320 high


void loop(void) {
    uint8_t y;
    uint16_t maxscroll;
    maxscroll = tft.width();    //  320
             for (y=320; y > 0 ; y-- ) {
             tft.setCursor( 0 , y);

void myText() {
    tft.println("1 The quick brown fox jumps over the lazy dog.  ");
    tft.println("2 The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog.");
    tft.println("3 The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog");

    tft.println("40 The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog);

Actually it sounds fun to do a subwindow scroll in software. I will see how practical it is. I might even put it in the demo sketch.

My 9486 is write-only. So I can only test it on a 9488.


Hey-ho. It works but is really SLOW.

uint16_t scrollbuf[480];                  //my biggest shield is 320x480
void windowScroll(int16_t x, int16_t y, int16_t wid, int16_t ht, int16_t dx, int16_t dy, uint16_t *buf)
    if (dx) for (int16_t row = 0; row < ht; row++) {
        tft.readGRAM(x, y + row, buf, wid, 1);
        tft.setAddrWindow(x, y + row, x + wid, y + row);
        tft.pushColors(buf + dx, wid - dx, 1);
        tft.pushColors(buf + 0, dx, 0);
    if (dy) for (int16_t col = 0; col < wid; col++) {
        tft.readGRAM(x + col, y, buf, 1, ht);
        tft.setAddrWindow(x + col, y, x + col, y + ht);
        tft.pushColors(buf + dy, ht - dy, 1);
        tft.pushColors(buf + 0, dy, 0);

and test it with:

            tft.setCursor(0, 200);
            tft.println("WINDOW SCROLL   ");
            for (int16_t i = tft.width(), dx = 8; i > 0; i -= dx) {
                windowScroll(0, 0, tft.width(), tft.height(), dx, 0, scrollbuf);

If you choose dx=1 it takes forever.

Of course, if your “window” is small, it will be correspondingly quicker.
e.g. slow scroll one line of text rather than the whole screen.
Of course, you could simply re-write a single line of text with a different start position

            tft.setCursor(0, 200);
            tft.println("WINDOW SCROLL   ");
            for (int16_t i = tft.width(), dx = 1, dy = 1; i > 0; i -= dx) {
                windowScroll(0, 200, tft.width(), 16, dx, dy, scrollbuf);

Edit. corrected code

Hi David,

Thanks again - I tried what you posted but get what is shown in the attached photo.

It starts with green “WINDOW SCROLL” then what you see in photo but scrolling right to left.

(You may remember from previous thread that my TFT arrived smashed)

Second example is similar but moving faster.

I do get what you are doing in essence I think … which is to shift the graphics memory around
at high speed to simulate scrolling. I will try and do this sometime.

The actual TFT is shown here …

Thanks again


Well, I will avoid Ebay seller "lakeyx101" I have ordered one from "sag222" because he has sold 130 of them.

Yes, I think we have discussed the fact that your ILI9486 reads 16-bits from GRAM memory. The library was reading 24-bits per pixel.

It is already fixed in the next release of the library.

I can't see much point in using a smashed screen. Are they sending you a replacement or refunding your money?


Have agreed a replacement but last one took 29 days to arrive and I am at day 3 at the moment for the replacement. However, I have also ordered a 4.3 inch elsewhere as well (and am at day 2 on that).

Yes I think I go on hold.... , do have a colorduino clock to finish LOL

Thanks all the same

hiii friends I have come up with solutions for horizontal scrolling means in landscape mode and its working great