I am playing with 3,5" (400x240) TFT display which is placed into Arduino Mega 2560 R3 board.

My final goal is taking .raw data from SD card and drawing it on display.

What I have done so far:

- My drawing method in the sketch:

void LoadImage(File& file)
    for (int y = 0; y < SCREEN_HEIGHT && file.available(); y++) {
        uint16_t buf[SCREEN_WIDTH];
        for (int x = SCREEN_WIDTH - 1; x >= 0; x--) {
            byte l = file.read();
            byte h = file.read();
            buf[x] = ((uint16_t)h << 8) | l;
        myGLCD.drawPixelLine(0, y, SCREEN_WIDTH, buf);

- For reference drawPixelLine method's implementation from UTFT library:

void UTFT::drawPixelLine(int x, int y, int sx, uint16_t* data)
    unsigned int col;
    cbi(P_CS, B_CS);
    setXY(x, y, x+sx-1, y);
    for (int tc=0; tc<sx; tc++)
        char* p = (char*)&data[tc];
        LCD_Write_DATA(*(p + 1), *p);
    sbi(P_CS, B_CS);
void UTFT::setXY(word x1, word y1, word x2, word y2)
    if (orient==LANDSCAPE)
        swap(word, x1, y1);
        swap(word, x2, y2)
        swap(word, y1, y2)

My current rendering:

current result

Desired image:

enter image description here

TFT Lcd and Mega Board enter image description here


I ran henningan test from utft library, drawing sin/cos graph and simple squares

enter image description here

Here is attempt to render yellow square 100x100 raw data

enter image description here

  • Have you tried drawing a solid image first? Dec 20 '14 at 6:04
  • @IgnacioVazquez-Abrams I tried to render yellow square, but without success. Please, see my updated post Dec 20 '14 at 16:48

I'have the same LCD from mcufriend and it doesn't work with original UTFT library.

Try modified version from https://github.com/dgolda/UTFT and use:

myGLCD(NIC35WS,38,39,40,41); //3.5" TFTLCD for arduino 2560 from mcufriend.com

it is too difficult for starters.maybe you can try this UART TFT LCD. tutorial:http://blog.iteadstudio.com/product-preview-nextion-in-an-arduino-project-2/

  • This doesn't really seem to provide an answer to the question. It actually looks like spam because the first thing on that page is an advert for a crowd-funding page. Are you affiliated with that site in some way? Apr 16 '15 at 20:36
  • Maybe you dont want to throw away your old LCD, and to konw a new world. by the way, money is in your pocket.
    – Bluce chen
    Apr 17 '15 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.