JFET

Based on ESP8266TFT display

 
Overview

Use ESP12F to drive TFT screen display. There are two USB to serial port chips in the schematic diagram. It is recommended to choose CH340C. It can be downloaded automatically. If the smallest size is required, CH340E can be used. I put two displays, one is 1.8 inches, and the other is 2.4 inches, you can choose it yourself. The package modifies itself.

TFT_eSPI library user manual

1. TFT_eSPI configuration

1. Download the tft_espi library

https://github.com/Bodmer/TFT_eSPI

It is strongly recommended to use the older version, around 2.0. The new version will have problems such as display inversion.

2. Unzip and import it into the libraries in the root directory of arduino.

(You can also install it directly using the arduino compiler. The path is in the computer's Quick Access->Documentation->Arduino->libraries)

3. Open the file User_Setup.h (it is recommended to open it with notepad++, it is more powerful and can open many types of files). It can be seen from the file name that this file needs to be modified by the user himself.

zAfOlZPRQc2p3s0Obx4uY07sCZem7hR6Q4goJ7Tr.png

1. Open the file User_Setup.h and modify the parameters according to your own screen information.

08rLertlTXHsRv7nDG6QZRwYkLvdNix1WXZvUnXj.png

2. Select the driver chip of the screen. Here is ST7735 as an example. Just remove the "//" in front of it.

3. Select the screen pixel (I use a 128*160 screen, just remove "//")

ktYNN5jIUDxPOBTmUBm12nXPWNbEC1bCjSeTGRtU.png

4. Select pins according to your own schematic diagram

5NCKO5mGA95vMtf5WHUF7OfyPt7e7yMtR4Ls3dhA.png

ajE1YQ9Nzueu9qbm6RuozHInuCqKwakieQbNociV.png

If the screen reset RST is introduced and connected to the ESP8266,

Just remove the "//" before //#define TFT_RST -1, and block the previous statement at the same time.

The picture below is the pin correspondence diagram of ESP8266

lrAwfW0FTg5gDhqsATgbikfI8wc8qYCLZouIgHQL.png

5. Adjust SPI speed

tUQmSKARVhzoVNU2lLtgeak0K84atioEXamoMlp3.png

The default is 270000000, here I set it to 40000000.

At this point you can use the routine test screen that comes with TFT_eSPI

a6PFzMJBOj5xxuLpqhAAvv1zU832dNXBwmE9ejpz.png

The routine is here

At this point, the TFT_eSPI library is configured.

2. TFT_eSPI library tutorial

1. Color adjustment

McrKZBUqyEPhbTUb9akAJqtEEQfWEevWIGQ1p8wg.png

  1. Common colors have been defined in the library and can be called directly when needed.
  2. To customize the color, use the statement tft.color565(); (the parameter is the RGB value corresponding to the color)

UbU7A9xBR6bMnN4KyB34zMs2y31saQcWYXI7pvzt.png

  1. Set translucency and fill in the tft.alphaBlend() where the color is used;

For example: tft.alphaBlend(20, TFT_RED, TFT_WHILE);

2. Set font

The number range is 1, 2, 4, 6, 7, 8. Different numbers represent different fonts. Different fonts have different basic sizes due to different resolutions.

If you want to learn the custom font library, please refer to ArduinolibrariesTFT_eSPIexamples320 x 240TFT_Custom_Fonts

3. Related APIs

1. tft.init(); //Initialize the initialization screen. If it is ST7735, you can pass a parameter into it. You will see when it is used.

2. tft.fillScreen(TFT_BLACK); //Fill the full screen

3. Screen rotation

//Set the rotation angle of the screen display. The parameters are: 0, 1, 2, and 3 respectively represent 0°, 90°, 180°, and 270°.

void setRotation(uint8_t r);

4. Screen color inversion

//Invert the display color i = 1 is inverted, i = 0 is normal

tft.invertDisplay(bool i);

4. Display text

1. tft.setCursor(20, 10, 4); //Set the typing starting coordinate position and font size

2. tft.setTextColor(TFT_BLACK); //Set font color

3. tft.setTextSize(2); //Set the font size (range 1~7)

4. tft.print("Hello World!"); // Display font

5. Draw characters

1. Draw a string (left)

lw4MRX4Z9d37M8p0CRfWimC86f1lJwxuAG9VXuXF.png

2. Draw string (centered)

V0ZsW5viGpHkRdN7WHDXavDueQbLiSTahVaUk0Ha.png

3. Draw a string (right)

nUxww7AunpJHMCCD6dFW5hluGtcdzr4JgtfjN824.png

4. Draw characters

xnCbD13FMCJO9eftNtFAKCsrLlSqozoLpuu86dBo.png

5. Draw floating point numbers

rBLFw6IxMQBBjToaEQiT1IHuG4BTdogoufKteWGk.png

6. Draw numbers

XMucUjblqiPoWvt8QU2h8FgJJsVYAlmRwTeCTvl8.png

6. Draw geometric figures

1. Draw dots

q7redKQK3rfhL0u7VAsMAF9I3SAWKkvteSTfRNv6.png

2. Draw lines

xFDs6VpnUfhuv2AyVXU49wsfXurrVqNiLY8LPqKa.png

3. Draw horizontal lines (quick)

ICcmMMRKBpsPFUTdmARxp61roHP7EIqD9vjQXB6x.png

4. Draw vertical lines (quick)

dk8ndsGBuuL6eNBjwBzxmfAVsO2pAsAy1PmOuzys.png

5. Draw a hollow circle

9lwJDOw350xHG20KVuUVin9MHkZJmtV8BIylmbxe.png

6. Draw a solid circle

Awea5VxtMETb84xsEU9h9MFrATUhPeLLKbQlbJAt.png

7. Draw a hollow ellipse

xu2AmTRGdoe2derzIq5nsekyLXHBGtEKIYZlj5gb.png

8. Draw a solid ellipse

umXIfgO3Hx8QDqQECVt1szbL2Gr3EZoFplkAASDZ.png

9. Draw a hollow rectangle

PKpGRlZC1EnrfcGINEIapdrnzTk0jxPD8R6fZGGO.png

10. Draw a solid rectangle

BFviOp7ydHlkDGSinMEovG4ozZm9XKo8W8YHSEbr.png

11. Draw a hollow rounded rectangle

vivXg6bs98IVT88OuNRA5PjjxH2hbq9eOSN5HVm.png

12. Draw a solid rounded rectangle

tThBwt7NQrtJN8eCOibsC38DEtqW0qWcbnF8zibJ.png

13. Draw a hollow triangle

FGQ1q71nW4LyZMZxQMJOLSQRSurG7EG1Za3NWwGy.png

14. Draw a solid triangle

iUVHIZTxAl0GKH9jCXuELcRUaeh0QO146TsV8o3k.png

7. Display pictures

Displaying images requires the mold taking software lcd-image-converter

VioXipyNhsf2M5tJEosuwBK2NX0L2OLbby4audjy.png

Adjust the pixel size of the image to not exceed the screen size -> Click File->Open->Select the image->Options->Conversion...->Set as shown in the interface->Shoe Preview->Copy the array

QLxqgGnYyatpHMTEiTZ0WR2rEg90QQm1tqskSDHo.png

The mold taking is now complete.

Create a new jpg.h file, and save the array just copied moduloly within the braces of the const unsigned short bmp[] PROGMEM={}; statement.

Routine:

#include<jpg.h>

#include<TFT_eSPI.h>

TFT_eSPI tft = TFT_eSPI();

void setup() {

tft.init();

tft.pushImage(0,0,128,160,bmp);

}

void loop() {

}

This will display the picture.

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 21:04:39

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号