Go Down

Topic: Graphics library for NodeMCU (ESP8266), ESP32 and serial+parallel TFT displays (Read 63525 times) previous topic - next topic


OK, so you need to add:
Code: [Select]


to the setup file. This corrects the display black/white swap. The examples should then run with the correct colours.

If you see colours in images (jpegs etc) are wrong then you need to add:
Code: [Select]


to your sketch. This corrects for the endianess of the byte order.


I`m also fight with same display. tft.invertDisplay(true) makes all examples work ok :-)
I need to change

#define SPI_FREQUENCY  20000000

to 10000000

and I think this is main homer2009 problem.

But drawJpeg from TFT_eFEX draw bad colors from jpeg :-( Colors are near the truth colors but not the same. Bright red is yellow, darker red is something like magna.



Thanks for the answer. Tomorrow I will check and let me know if the display works well


It sounds like you have a different drive chip in your display and the colour settings loaded during init are not compatible with it.  This is also indicated by the need for the inversion which is not necessary on my ILI9486 based display. Do the rotations look OK on the graphics test?


Hello Bodmer.An oath of examples(coulor_test)they work properly.
Example TFT_flash_jpg proceeds incorrectly.
Next it displays bad colors


As your display has a different colour setup try using:


and if that does not work try:


One of these lines may need to be added in setup() of each sketch if you are handling images in the sketch. This swaps the colour bytes.


1. If the colours have been corrected by TFT_INVERSION_ON everything else should work.

2. The JPEG programs should read the JPEG file in the byte order on disk and calculate the pixel colours.

3.  Since the pixel colours were fixed in (1),   the JPEG image should be correct.

Most Arduino targets are little-endian
TFT controllers are big-endian.   

If a "raw" image is dumped from TFT Graphics Memory it will read pixels as RGBRGBRGB... on most controllers.
Other controllers will read as 16-bit pixels (5-6-5 format) as HLHLHL... i.e. big-endian

The TFT_eSPI library will know what to do with any published image format like .BMP or .JPG

The byte-order problem will only arise with "RAW" byte dump images.
They might be stored in HLHL... order or in LHLH... order.
Hence you might need to use the setSwapBytes() feature

I do not own any "shift register style" displays.



@bodmer I just found your Dark Sky library after searching for an OWM alternative.

I just wanted to say a big thanks for your work!! :)

Also, I only have 128x128 TFT at the moment so have not used your TFT_eSPI library, but I have some larger displays on the way :)


My appreciation to the excellent works of the Arduino masters such as david_prentice and others here and especially to Master Bodmer. I like a lot of images in tft display like this 'ESP8266_draw_565_image2' but, I also like scrolling text on display, so I wonder if Bodmer or anyone made available here some sketch for Arduino or espodel for text scrolling, vertical in color? Thank you all


General question related to do touch implementation:

I have some code that reads a physical switch which I want to change to a touch area. It's based on a state machine style coding. (Forgot to mention it's M5Stack-MultiApp-Advanced which display is using the TFT_eSPI driver)

I have an idea about the code but need some pointers if I am on the right track.
Somewhere along the line of this:

Code: [Select]

//define touchArea for button 1
u_int 16 OnScreenBtnP.X = 100
u_int 16 OnScreenBtnP.X1 = 160
u_int16  OnScreenBtnP.Y = 80
u_int16  OnScreenBtnP.Y1 = 140

* read() returns the state of the on-screen touch button, 1==pressed, 0==released, missed etc.   *

uint8_t Button::read(void)
    if (touchController.isTouched(500) && millis() - lastTouchMillis > 1000) {
        TS_Point p = touchController.getPoint();
        lastTouchPoint = p;
        lastTouchMillis = millis();
        if (p.y = > OnScreenBtnP.Y and < OnScreenBtnP.Y1) {
          if (p.x = > OnScreenBtnP.X and < OnScreenBtnP.Y1) {
       _state = 1 // Consider virtual button button1 pressed
 return _state;
    else {
            _state = 0; //missed, released, not pressed or wrong area, consider state 0
        return _state;



@Dancopy: have a look at the "TFT_Terminal" example. Hardware based scrolling is available in portrait orientation only for full width of screen. For small scrolling areas see Sprite scroll examples.

@Mac_che: see "On_Off_Button" example.


How to interface 3.2" UTFT ILI9481 with NodeMCU  ???? Kindly Help



Taking advantage of the opportunity, I would like to ask Master Bodmer if it is possible to use his 2 Digital and Analog Clock sketches with his TFT_eSPI library for a 3.5 "display ili9488 with ESP32 or ESP8266; thanks

Go Up