4.0" TFT with ST7796S driver and TFT_eSPI library #3160
Replies: 1 comment 1 reply
-
further information : I used the below code example to test the display and I am using PlatformIO 👍 /* This example displays a keypad where numbers can be entered and The sketch has been tested on the ESP8266 (which supports SPIFFS) The minimum screen size is 320 x 240 as that is the keypad size. TOUCH_CS and SPI_TOUCH_FREQUENCY must be defined in the User_Setup.h file // The SPIFFS (FLASH filing system) is used to hold touch screen #include "FS.h" #include <SPI.h> TFT_eSPI tft = TFT_eSPI(); // Invoke custom library // This is the file name used to store the calibration data // Set REPEAT_CAL to true instead of false to run calibration // Keypad start position, key sizes and spacing // Using two fonts since numbers are nice when bold // Numeric display box size and location // Number length, buffer for storing it and character index // We have a status line for messages // Create 15 keys for the keypad // Invoke the TFT_eSPI button class and create all the button objects //------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------ void drawKeypad()
} //------------------------------------------------------------------------------------------ void touch_calibrate() // check file system exists // check if calibration file exists and size is correct if (calDataOK && !REPEAT_CAL) {
} //------------------------------------------------------------------------------------------ // Print something in the mini status bar //------------------------------------------------------------------------------------------ void setup() { // Initialise the TFT screen // Set the rotation before we calibrate // Calibrate the touch screen and retrieve the scaling factors // Clear the screen // Draw keypad background // Draw number display area and frame // Draw keypad //------------------------------------------------------------------------------------------ void loop(void) { // Pressed will be set true is there is a valid touch on the screen // / Check if any key coordinate boxes contain the touch coordinates // Check if any key has changed state
} |
Beta Was this translation helpful? Give feedback.
-
Hi, I am using a 4.0" TFT with ST7796S driver connected to an ESP32 using the setup27from the TFT_eSPI library.
I verified the suggested connections which are all OK.
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4
However, the TFT display stays black, no action at all.
I am wondering if the display is a failed one.
Any suggestions how I can test this ?
Beta Was this translation helpful? Give feedback.
All reactions