Arduino Tutorial 2: How to Setup Mcufriend 2.4″ LCD TFT libraries and avoid white screen

5722
38
SHARE


Download Mcufriend 2.4- LCD TFT libraries for… By Mole-Android

Download Mcufriend 2.4- LCD TFT libraries Now

[signinlocker]Click Here to Download The Libraries[/signinlocker]

38 COMMENTS

  1. Thank you for these libraries – they work. After trying four or five others, this one finally just worked. Since I’m new to pretty much everything involved in programming and microcontrollers, it’s a relief to find out it wasn’t just me doing something wrong. %)

  2. hello i have some problem whit this library like this:
    Arduino:1.6.5 (Windows 7), Scheda:”Arduino Uno”

    graphicstest:11: error: conflicting declaration ‘Adafruit_TFTLCD tft’
    graphicstest.pde:41:21: note: in expansion of macro ‘LCD_CS’
    graphicstest:20: error: ‘tft’ has a previous declaration as ‘TFTLCD tft’
    graphicstest.pde: In function ‘void setup()’:
    graphicstest:46: error: redefinition of ‘void setup()’
    graphicstest:22: error: ‘void setup()’ previously defined here
    graphicstest:60: error: ‘class TFTLCD’ has no member named ‘readID’
    graphicstest:88: error: ‘class TFTLCD’ has no member named ‘begin’
    graphicstest.pde: In function ‘void loop()’:
    graphicstest:142: error: redefinition of ‘void loop()’
    graphicstest:55: error: ‘void loop()’ previously defined here
    graphicstest.pde: In function ‘long unsigned int testFastLines(uint16_t, uint16_t)’:
    graphicstest:244: error: ‘class TFTLCD’ has no member named ‘drawFastHLine’
    graphicstest:245: error: ‘class TFTLCD’ has no member named ‘drawFastVLine’
    graphicstest.pde: In function ‘long unsigned int testTriangles()’:
    graphicstest:333: error: ‘class TFTLCD’ has no member named ‘color565’
    graphicstest.pde: In function ‘long unsigned int testFilledTriangles()’:
    graphicstest:349: error: ‘class TFTLCD’ has no member named ‘color565’
    graphicstest:352: error: ‘class TFTLCD’ has no member named ‘color565’
    graphicstest.pde: In function ‘long unsigned int testRoundRects()’:
    graphicstest:369: error: ‘class TFTLCD’ has no member named ‘color565’
    graphicstest.pde: In function ‘long unsigned int testFilledRoundRects()’:
    graphicstest:385: error: ‘class TFTLCD’ has no member named ‘color565’
    Multiple libraries were found for “Adafruit_GFX.h”

    Used: C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX

    Not used: C:\Program Files (x86)\Arduino\libraries\AdafruitGFXLibrarymastermod

    Not used: C:\Program Files (x86)\Arduino\libraries\AdafruitGFXLibrarymaster

    conflicting declaration ‘Adafruit_TFTLCD tft’

    pls can u help me??

  3. Hey skimmie,

    I’m new to Arduino, so I may not be giving you the info you need, but in the setup function, it seems to be identifying the following LCD drivers:
    ILI9325
    ILI9327
    ILI9328
    HX8347G
    ILI9341
    HX8357D
    S6D0154
    Other than these, it outputs (to the serial port) the message “Unknown LCD driver chip”.

    Hope this helps.

  4. Thanks Mole Android!
    When I couldn’t get tftbmp to work, I tried some other libraries, but NONE of these worked!
    I changed Adafruit_TFTLCD.cpp to:

    void Adafruit_TFTLCD::pushColors(uint16_t *data, uint8_t len, boolean first) {
    uint16_t color;
    uint8_t hi, lo;
    CS_ACTIVE;
    if(first == true) { // Issue GRAM write command only on first call
    CD_COMMAND;
    write8(0x2C);
    }
    CD_DATA;
    while(len–) {
    color = *data++;
    hi = color >> 8; // Don’t simplify or merge these
    lo = color; // lines, there’s macro shenanigans
    write8(hi); // going on.
    write8(lo);
    }
    CS_IDLE;
    }

    and it worked! I think the CD_COMMAND, write8(0x2C) kept clearing the screen every colour push, so I changed the code to only do it for the “first” display buffer write.
    Hope it helps

  5. Thanks, that finally worked! The touch screen is working, but the coordinates are rotated 90 degrees clockwise… how do I set the rotation on the touchscreen?

      • I found a Solution for your Problem (i had the same ^^) Just change the following code lines from:

        #define YP A1 // must be an analog pin, use “An” notation!
        #define XM A2 // must be an analog pin, use “An” notation!
        #define YM 7 // can be a digital pin
        #define XP 6 // can be a digital pin

        to:
        #define YP A2 // must be an analog pin, use “An” notation!
        #define XM A1 // must be an analog pin, use “An” notation!
        #define YM 6 // can be a digital pin
        #define XP 7 // can be a digital pin

        And it will work correct.

        Cheers!
        //Moe

  6. The library works. The graphics is working, the touchscreen is working. Thanks a lot. Your library is the only one working for my mcu display.

    One last thing, the SD card still fail to initialize. Could you help ?

  7. Do you have a version of the libraries that work in Arduino IDE 1.5 and/or lower?
    I have IDE versions 1.0, 1.0.5-r2, 1.5 and 1.6.4. Attempting to load the libraries in anything but 1.6.4 results in an “Invalid Library” error.
    I am wanting to the library/text functions to Tiny Basic Plus but am hitting a wall: TB+ won’t compile in the 1.6 IDEs (PROGMEM related errors) and TFTLCD won’t import in anything lower that I have.

    Basically the two reside in two separate worlds.

    Note that I have tried both the Import Library and unzipping the libraries to the Library folder, both methods fail.

  8. Since this is using a shield, the SD card and the LCD are piggy-backed. In other words, some of the pinouts are shared. In order for the sdcard to be available at runtime, you have to ensure that it is initialized before the LCD.

  9. Hola a todos.
    Tengo una pantalla de TFT LCD 2.4″ con chip ILI9335, pero no he podido conseguir el controlador por ninguna parte. lo mas que he podido hacer es instalar la librería de la SPFD5408 pero toda la pantalla sale al revés como en un espejo. me podrían ayudar con la librería para el 9335 o o la forma de invertir la pantalla.

  10. Bitmaps won’t be displayed.
    This comes from an implementation bug of
    void Adafruit_TFTLCD::pushColors(uint16_t *data, uint8_t len, boolean first).

    There is a bug with the brackets.

    correct code is:

    void Adafruit_TFTLCD::pushColors(uint16_t *data, uint8_t len, boolean first) {
    uint16_t color;
    uint8_t hi, lo;
    CS_ACTIVE;
    if(first == true) { // Issue GRAM write command only on first call
    CD_COMMAND;
    if(driver == ID_932X) write8(0x00);
    if ((driver == ID_9341) || (driver == ID_HX8357D) || (driver == ID_ILI9327)){
    write8(0x2C);
    } else if (driver == ID_S6D0154){
    write8(0x22);
    } else {
    write8(0x22);
    }
    }
    CD_DATA;
    while(len–) {
    color = *data++;
    hi = color >> 8; // Don’t simplify or merge these
    lo = color; // lines, there’s macro shenanigans
    write8(hi); // going on.
    write8(lo);
    }
    CS_IDLE;
    }

  11. Hi,
    I have a Arduino Mega and ILI9341 TFT module. I have used your libraries but still it is showing as Unknown LCD driver Chip.
    please advise how to solve this. I have tried every library I found but no luck.
    Thank You

  12. Hi,
    i have an Arduino Mega and ILI9341 TFT LCD shield. I have used your libraries but the screen still remains white.
    and the serial monitor output shows as Unknown LCD driver chip.
    Please suggest a way to solve this.
    Thank you

  13. You are my Hero!!! After trying too much of libraries, this libraries is the only one that works fine with my mcufriend tft.
    Thank you very much.

Leave a Reply