#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <Adafruit_ILI9341.h>
#define TFT_CS 6
#define TFT_DC 4
#define TFT_RST 5
#define TFT_MOSI 10
#define TFT_SCLK 8
#define SCR_WD 240
#define SCR_HT 240
#ifdef ILI9341
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#else
Adafruit_ST7789 tft = Adafruit_ST7789(-1, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
#endif
void setup(void)
{
Serial.begin(9600);
Serial.write("Starting\n");
#ifdef ILI9341
Serial.write("Simulating ILI9341\n");
tft.begin();
#else
Serial.write("Simulating ST7789\n");
tft.init(240, 240);
#endif
tft.setRotation(1);
tft.setCursor(20, 20);
tft.setTextColor(0xFFFF);
tft.setTextSize(2);
tft.print("HELLO WORLD");
Serial.println("Done\n");
}
void loop()
{
}
Loading
xiao-esp32-c3
xiao-esp32-c3