Go Down

Topic: Displaying Bitmap on tft with <MCUFRIEND_kbv.h> (Read 127 times) previous topic - next topic

SL42

Hi again :)


I have now googled me to sleep for som days trying to solve my issue with no results. 
Im sure that you guys have a simple answer to this.


Im running a TFT with the  <MCUFRIEND_kbv.h> library. 

I just want to display a bitmap pic from the SD card. With the example code "showBMP_kbv_Uno" it works.
BUT the example is done so it will display all pics on SD. In my case my (only one file) bitmap is just roled out and then disapears in like 2 sec. 

I wuld be happy if somone can just tell me wish part of the example code I shuld save to just display the pic and then do no more.


The example code "showBMP_kbv_Uno" is added.


Sorry for bad english, hope you can live with that. 

david_prentice

Go on.   It is pretty simple for a Uno.

Code: [Select]

void setup()
{
    uint16_t ID;
    Serial.begin(9600);
    Serial.print("Show BMP files on TFT with ID:0x");
    ID = tft.readID();
    Serial.println(ID, HEX);
    if (ID == 0x0D3D3) ID = 0x9481;
    tft.begin(ID);
    tft.fillScreen(0x001F);
    tft.setTextColor(0xFFFF, 0x0000);
    bool good = SD.begin(SD_CS);
    if (!good) {
        Serial.print(F("cannot start SD"));
        while (1);
    }
    uint8_t ret = showBMP("/woof.bmp", 0, 0);
}

SL42

Tnx! works just fine  :)

Do i need to have everything in the Void Loop left or culd some of it be removed? 

david_prentice

You can have an empty void() function if you like.   Or put your "real" program.

You only asked for displaying one picture:

Code: [Select]

    ...
    bool good = SD.begin(SD_CS);
    uint8_t ret = showBMP("/woof.bmp", 0, 0);
    ...


Obviously you keep the showBMP() and read16() and read32() functions.

David.

SL42


Go Up