#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 4
#define TFT_CS 5
#define TFT_MOSI 6
#define TFT_CLK 7
#define TFT_CTRL 45
#define TFT_RST 48
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST);
const char* message = "I AM ARVIND FROM INDIA\nHAVE A NICE DAY WRITING LIKE TYPING!";
int msgIndex = 0;
unsigned long previousMillis = 0;
const long interval = 400; // Interval for typing effect
void setup() {
Serial.begin(115200);
Serial.println("Welcome to Wokwi, ESP32-S3");
pinMode(TFT_CTRL, OUTPUT);
digitalWrite(TFT_CTRL, HIGH);
tft.begin();
// Configure the direction of the display
const uint8_t mode = 0x48; // Change from 0xC8 to 0x48
tft.sendCommand(ILI9341_MADCTL, &mode, 1);
tft.setCursor(88, 60);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("ESP32-S3");
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (message[msgIndex] == '\n') {
tft.setCursor(36, tft.getCursorY() + 20); // Move to the next line
} else {
tft.print(message[msgIndex]);
}
if (message[msgIndex] != '\0') {
msgIndex++;
} else {
// Restart typing effect
tft.fillRect(36, 106, 200, 60, ILI9341_BLACK); // Clear the area where text is displayed
tft.setCursor(36, 106);
msgIndex = 0;
}
}
}
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1