#include <SPI.h>
#include <Ucglib.h>
// Pin mapping for ESP32-2432S028 (CYD)
#define TFT_CS 15
#define TFT_DC 2
#define TFT_RST -1 // Not connected
#define TFT_SCK 14
#define TFT_MOSI 13
#define TFT_MISO 12
// UCGLib constructor for ILI9341 SPI (hardware SPI)
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/TFT_DC, /*cs=*/TFT_CS, /*reset=*/TFT_RST);
void setup() {
Serial.begin(115200);
Serial.println("ESP32-2432S028 UCGLib Triangle + Text");
SPI.begin(TFT_SCK, TFT_MISO, TFT_MOSI, TFT_CS);
ucg.begin(UCG_FONT_MODE_TRANSPARENT);
ucg.clearScreen();
ucg.setRotate90(); // Landscape orientation
// Draw text
ucg.setFont(ucg_font_ncenR14_tr);
ucg.setColor(0, 255, 0); // Green text
ucg.setPrintPos(40, 40);
ucg.print("HELLO, ARVIND!");
// Draw triangle
ucg.setColor(255, 0, 0); // Red triangle
int x0 = 100, y0 = 100;
int x1 = 160, y1 = 200;
int x2 = 40, y2 = 200;
ucg.drawTriangle(x0, y0, x1, y1, x2, y2);
}
void loop() {
// Nothing animated here, just static display
}
https://wokwi.com/projects/462365019695171585