#include <TFT_eSPI.h> // Biblioteca para o display ILI9341
TFT_eSPI tft = TFT_eSPI(); // Inicializar o objeto para o display
void setup() {
// Inicializa o display
tft.init();
tft.setRotation(1); // Define a orientação do display (0-3)
// Limpa o display com uma cor de fundo
tft.fillScreen(TFT_BLACK);
// Exibe uma mensagem de boas-vindas
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Cor do texto e cor de fundo
tft.setTextSize(2); // Tamanho do texto
tft.setCursor(10, 10); // Posição inicial do texto
tft.println("Hello, ILI9341!");
// Desenhar algumas formas
tft.drawCircle(60, 60, 30, TFT_RED); // Desenhar um círculo
tft.fillRect(100, 100, 50, 50, TFT_BLUE); // Desenhar um quadrado preenchido
// Exibir mais texto
tft.setTextSize(3);
tft.setCursor(10, 150);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.println("ESP32 + ILI9341");
delay(2000); // Aguarde 2 segundos
}
void loop() {
// Exemplo de rotação de display e limpar a tela
for (int i = 0; i < 4; i++) {
tft.setRotation(i); // Mudar orientação do display
tft.fillScreen(TFT_BLACK); // Limpar o display com cor preta
// Exibir mensagem com nova orientação
tft.setCursor(10, 10);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
tft.setTextSize(2);
tft.println("Rotation: " + String(i));
delay(1000); // Esperar 1 segundo
}
}