/*
  ESP32-S2 + ILI9341 TFT LCD Example (using Franzininho WiFi)
  https://wokwi.com/projects/329013233501340242
*/

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

#define TFT_DC 2
#define TFT_CS 15

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

const uint32_t colors[] = {
  ILI9341_RED,
  ILI9341_GREEN,
  ILI9341_BLUE,
  ILI9341_CYAN,
  ILI9341_MAGENTA,
  ILI9341_YELLOW,
  ILI9341_ORANGE,
};

uint8_t colorIndex = 0;

void setup() {
  tft.begin();
  tft.setCursor(20, 120);
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(3);
  tft.println("Franzininho");
  tft.setCursor(80, 164);
  tft.setTextColor(ILI9341_YELLOW);
  tft.println("WiFi");
}

void loop() {
  tft.setTextSize(2);
  tft.setCursor(64, 208);
  tft.setTextColor(colors[colorIndex++ % 7]);
  tft.println("SPI works!");
  delay(250);
}