#include <SPI.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup(void) {
Serial.begin(115200);
tft.init();
tft.setRotation(0);
Serial.printf( "W x H = %d x %d pixels\n", tft.width(), tft.height() );
// Fill screen with black color
tft.fillScreen(ILI9341_BLACK);
// Draw a white rectangle frame
tft.drawRect(0, 0, tft.width(), tft.height(), ILI9341_WHITE);
// Set the text alignment to top-left
tft.setTextDatum(TL_DATUM);
// Set text color to green
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
// Set text size
tft.setTextSize(3);
// Get the width of the text in pixels
char *text = "ILI9341 LCD";
int16_t text_width = tft.textWidth(text);
// Draw the text on the display
tft.drawString( text, (tft.width() - text_width)/2, tft.height()/2 );
}
void loop() {
delay(10);
}