ArduinoMega + IL9481 - How to display graphics

I bay the IL9481 display powered 5V from ArduinoMega - I know that the logic on the SD card is 3V3. I can not connect the SD reader on TFTSheeld to the Arduino Mega. Wrong pinout. Therefore, my question whether it is possible to display simple small graphics not from the SD card?

Sorry for my english

The answer is yes.

The Mcufriend_kbv library will run with that TFT display on a Mega. If you run the graphictest_kbv example sketch you will see that after the main graphics functions tests that a penguin is drawn on the screen. That image is stored as an array of bytes in the "icons.c" tab.

Thank you for your help. I have uploaded the test and really is a penguin. Just say that where find somewhere a PDF with commands to the library …?

extern const uint8_t penguin ;
tft.setAddrWindow (X, Y, Z, A);
tft.pushColors (penguin, B, C);

which denote variables. XYZABC
How do I change variables my penguin also is changing but not understand. I do not know how to describe it

my code:

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4

#include <SPI.h>          
#include "Adafruit_GFX.h"
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

void setup(void) {

void loop(void) {
 extern const uint8_t penguin[];
           tft.setAddrWindow(240, 20, 440, 800);
           tft.pushColors(penguin, 1600, 1);

Look at the example:

            extern const uint8_t penguin[];
            tft.setAddrWindow(wid - 40 - 40, 20 + 0, wid - 1 - 40, 20 + 39);
            tft.pushColors(penguin, 1600, 1);

It is easier to follow if you put in fixed numbers:

            extern const uint8_t penguin[];       //array of 3200 bytes in Flash memory
            tft.setAddrWindow(25, 80, 64, 119);   //TLHC at 25,80 and BRHC at 64,119
            tft.pushColors(penguin, 1600, 1);     //40x40 pixels = 1600 pixels = 3200 bytes

Note that setAddrWindow() uses coordinates of the Rectangle i.e. TLHC, BLHC. Whereas fillRect() uses TLHC and dimensions of rectangle i.e. TLHC, width, height

I just followed the style of the Adafruit methods. In an ideal world, I would prefer to use TLHC and dimensions of rectangle for all methods. It seems more intuitive (to me)

Note that the coordinates of the TLHC of the screen are 0,0 The BRHC (bottom right hand corner) is 239,319 on a 240x320 Portrait. The BRHC (bottom right hand corner) is 319,239 on a 320x240 Landscape.

Adafruit have Tutorials and good documentation for the Adafruit_GFX graphics library. I have never produced any documentation for the MCUFRIEND_kbv library.

Any volunteers?

The penguin[ ] array is just stored as a sequence of bytes. Two bytes per pixel. Stored as bigendian.


I take the chance to publish here a tip that I offen use:

Put an empty file (create textfile) with the name of the directory with the library sources and extension .ino into that directory, then you can double click on that file and easily look at the source and header files.
From the header file it becomes clear in most cases what the parameters mean.

e.g. MCUFRIEND_kbv.ino in …\Documents\Arduino\libraries\MCUFRIEND_kbv

Now i understand all but i have a one Q: With onet program will convert the image file? I use the LCD assistant but he worked monochrome graphics.

There are many PC programs that will take a BMP and produce a “raw” file.
Either as a raw BIN file.
Or as a C array. That is how the Penguin was produced.

Look on the UTFT website.

Bear in mind that a Uno can only manage a 40x40 (3kB) or 64x64 (8kB) image.
You will never fit a 240x320 photo into a Uno Flash or even a Mega Flash.



which is I buy a SD reader :(

The microSD on your Shield should work fine on a Uno. I think that there is no Touch Panel.


The microSD slot on this particular display shield is wired directly to the 5V logic pins on an UNO/Mega and thus you risk damaging the SD card :frowning:

If you do choose to take the risk, then the microSD is not wired to the hardware SPI pins and thus you need to use a library such as sdFat that implements a software based SPI interface.