#include <TFT_eSPI.h>
// Pin Definitions for ESP32 DevKit V1
#define TFT_CS 15
#define TFT_DC 2
#define TFT_RST 16 // Set TFT_RST to -1 if not used
#define TFT_MOSI 23
#define TFT_CLK 18
#define TFT_SCLK 18
// #define TFT_LED 4 // Backlight control pin
#define BOXSIZE 40
int oldcolor, currentcolor;
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
void setup() {
tft.init(); // Initialize the TFT display
tft.setRotation(1);
tft.fillScreen(TFT_DARKGREY);
tft.setTextFont(2);
tft.fillScreen(ILI9341_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
currentcolor = ILI9341_RED;
}
void loop() {
// Leave empty or add your own code here if needed
}