Header Ads Widget

Graphic LCD ILI9341 Simulation with ESP32

In this blog, We are going to simulate the ILI9341 graphic LCD with ESP32 using the wokwi online simulator.

Components Required:

- ESP32
- ILI9341 2.5" Graphic LCD
- Simulator used: Wokwi

Circuit Diagram:

Source Code:

This code is using the Arduino_GFX_Library to drive an ILI9341 TFT display. The code initializes the display, sets the pin connections for the TFT display, and then sets the display to write "Hello World" in blue color with a text size of 2.

The first step is to include the Arduino_GFX_Library library at the top of the code. This library provides the necessary functions for controlling the display.

The next step is to define the pin connections for the TFT display. In this case, the TFT_SCK, TFT_MOSI, TFT_MISO, TFT_CS, TFT_DC, and TFT_RESET pins are defined with specific digital pin numbers on the ESP32 board.

In the setup() function, it creates an instance of the Arduino_ESP32SPI class and passed the pin connections as arguments. Then it creates an instance of the Arduino_ILI9341 class and passed the first instance as an argument, and also the TFT_RESET pin.

The display.begin() function is then called to initialize the display and set it up for use. The display.fillScreen(WHITE) function is then called to clear the screen and set the background color to white.

The display.setCursor(20, 20) function is then called to set the cursor position for the text to be displayed. The display.setTextSize(2) function is then called to set the text size to 2. The display.setTextColor(BLUE) function is then called to set the text color to blue. The display.print("Hello world") function is then called to display the text "Hello World" on the display.

In the loop() function, nothing happens, so the text will be displayed once and that's it.

This code is a simple example of how to display text on an ILI9341 TFT display using the Arduino platform and the Arduino_GFX_Library. You can modify the code to display different text, change the text color, or add more functionality to the display.

Video Tutorial:

Post a Comment