Xinyuan-LilyGO / T-Display-S3-Long

36 stars 11 forks source link

Missing a simple "Hello world" example. #26

Open aviost opened 2 months ago

aviost commented 2 months ago

Hi, It was not so easy to install, but after a struggle, I made it to compile and upload the factory example (I had to change the factory. ino to factory. ino.cpp).

Anyway, two hours after searching, chat gpt, etc. - I still can't write a simple "Hello world" on the screen by myself.

Like everybody else, I'm busy; I want to make it work - or just stay with my current ESP and other TFT, which works. You need a simple "Hello world" and other examples to get people started. It is a shame to make such a nice piece of hardware and miss all the first-timers who might give it away just because there are no examples. A programmer can make 10-20 nice, simple examples in less than a day. Please help with the "hello world" text on the screen, and I will be happy, as at this point - I didn't manage to make it myself, even like this:

include // Include the TFT_eSPI library

// Define the display settings directly in the sketch to override the library's User_Setup.h

define ST7789_DRIVER // Specify the display driver, for the ST7789

define TFT_WIDTH 240 // Width of the display in pixels

define TFT_HEIGHT 135 // Height of the display in pixels

define TFT_MISO -1 // Define as -1 if not used

define TFT_MOSI 19 // SPI MOSI pin

define TFT_SCLK 18 // SPI SCK pin

define TFT_CS 5 // Chip select pin

define TFT_DC 16 // Data/Command pin

define TFT_RST 23 // Reset pin

define TFT_BL 4 // Backlight control pin

define TFT_BACKLIGHT_ON HIGH // Backlight on level

TFT_eSPI tft = TFT_eSPI(); // Create an instance of the display library

void setup() { Serial.begin(115200);

// Initialize display tft.init(); tft.setRotation(1); // Set the display orientation tft.fillScreen(TFT_BLACK); // Clear the screen

// Initialize the backlight pinMode(TFT_BL, OUTPUT); // Set the backlight pin as output digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); // Set the backlight on

// Display static text tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextSize(2); tft.setCursor(0, 0); tft.println("Current Value:"); }

void loop() { static int value = 0; // Initialize a value to display

// Update the display tft.setCursor(0, 40); tft.setTextSize(3); tft.print(value);

value++; // Increment value for demonstration purposes delay(1000); tft.fillRect(0, 40, 240, 60, TFT_BLACK); // Clear the previous value area }