#include <TFT_eSPI.h>
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI();
#define W 320
#define H 240
unsigned long lastChange = 0;
const unsigned long ART_TIME = 5000; // 5 seconds each
int art = 0;
// --------------------------------------------------
// SETUP
// --------------------------------------------------
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
randomSeed(analogRead(34));
showArt(art);
lastChange = millis();
}
// --------------------------------------------------
// LOOP
// --------------------------------------------------
void loop() {
if (millis() - lastChange > ART_TIME) {
art++;
if (art >= 15) art = 0;
showArt(art);
lastChange = millis();
}
}
// --------------------------------------------------
// ART SELECTOR
// --------------------------------------------------
void showArt(int n) {
tft.fillScreen(TFT_BLACK);
switch (n) {
case 0: art1(); break;
case 1: art2(); break;
case 2: art3(); break;
case 3: art4(); break;
case 4: art5(); break;
case 5: art6(); break;
case 6: art7(); break;
case 7: art8(); break;
case 8: art9(); break;
case 9: art10(); break;
case 10: art11(); break;
case 11: art12(); break;
case 12: art13(); break;
case 13: art14(); break;
case 14: art15(); break;
}
}
// ==================================================
// ART 1 - GALAXY
// ==================================================
void art1() {
tft.fillScreen(TFT_BLACK);
for (int i = 0; i < 180; i++) {
int x = random(W);
int y = random(H);
uint16_t c = tft.color565(
random(100,256),
random(100,256),
255
);
tft.drawPixel(x,y,c);
}
int cx = 160;
int cy = 120;
for (int r = 90; r > 5; r -= 6) {
tft.drawCircle(cx,cy,r,
tft.color565(20,20,random(80,255)));
}
tft.fillCircle(cx,cy,18,TFT_WHITE);
tft.setTextColor(TFT_CYAN);
tft.setTextSize(2);
tft.setCursor(105,215);
tft.print("GALAXY");
}
// ==================================================
// ART 2 - SUN
// ==================================================
void art2() {
tft.fillScreen(TFT_NAVY);
for (int r=100; r>10; r-=8) {
uint16_t c = tft.color565(
255,
100 + r,
20
);
tft.drawCircle(160,120,r,c);
}
tft.fillCircle(160,120,55,TFT_YELLOW);
for(int a=0;a<360;a+=15){
float x = cos(a*DEG_TO_RAD);
float y = sin(a*DEG_TO_RAD);
tft.drawLine(
160+x*65,
120+y*65,
160+x*100,
120+y*100,
TFT_ORANGE
);
}
tft.setTextColor(TFT_YELLOW);
tft.setTextSize(2);
tft.setCursor(125,215);
tft.print("SUN");
}
// ==================================================
// ART 3 - FLOWER
// ==================================================
void art3() {
tft.fillScreen(TFT_BLACK);
int cx=160;
int cy=120;
for(int i=0;i<16;i++){
float a=i*22.5*DEG_TO_RAD;
int x=cx+cos(a)*65;
int y=cy+sin(a)*65;
tft.fillCircle(
x,y,
30,
tft.color565(
random(100,255),
random(30,150),
random(150,255)
)
);
}
tft.fillCircle(cx,cy,25,TFT_YELLOW);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(125,215);
tft.print("FLOWER");
}
// ==================================================
// ART 4 - DNA
// ==================================================
void art4() {
tft.fillScreen(TFT_BLACK);
for(int y=20;y<210;y+=4){
float a=y*0.08;
int x1=100+sin(a)*60;
int x2=220+sin(a)*60;
tft.drawLine(
x1,y,
x2,y,
TFT_CYAN
);
tft.fillCircle(x1,y,4,TFT_BLUE);
tft.fillCircle(x2,y,4,TFT_MAGENTA);
}
tft.setTextColor(TFT_CYAN);
tft.setTextSize(2);
tft.setCursor(135,215);
tft.print("DNA");
}
// ==================================================
// ART 5 - ATOM
// ==================================================
void art5() {
tft.fillScreen(TFT_BLACK);
int cx=160;
int cy=120;
tft.fillCircle(cx,cy,15,TFT_YELLOW);
for(int a=0;a<360;a+=45){
float r=a*DEG_TO_RAD;
for(int i=0;i<360;i+=3){
float p=i*DEG_TO_RAD;
int x=cx+cos(p)*100;
int y=cy+sin(p)*30;
int xx=x*cos(r)-y*sin(r)+cx;
int yy=x*sin(r)+y*cos(r)+cy;
tft.drawPixel(xx,yy,TFT_CYAN);
}
}
tft.setTextColor(TFT_YELLOW);
tft.setTextSize(2);
tft.setCursor(140,215);
tft.print("ATOM");
}
// ==================================================
// ART 6 - RAINBOW
// ==================================================
void art6() {
tft.fillScreen(TFT_BLACK);
uint16_t colors[]={
TFT_RED,
TFT_ORANGE,
TFT_YELLOW,
TFT_GREEN,
TFT_CYAN,
TFT_BLUE,
TFT_MAGENTA
};
for(int i=0;i<7;i++){
tft.drawCircle(
160,
210,
150-i*18,
colors[i]
);
}
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(120,20);
tft.print("RAINBOW");
}
// ==================================================
// ART 7 - MATRIX
// ==================================================
void art7() {
tft.fillScreen(TFT_BLACK);
for(int i=0;i<80;i++){
int x=random(W);
int y=random(H);
tft.setTextColor(TFT_GREEN);
tft.setTextSize(1);
tft.setCursor(x,y);
tft.print(random(0,2));
}
tft.setTextColor(TFT_GREEN);
tft.setTextSize(3);
tft.setCursor(95,105);
tft.print("MATRIX");
}
// ==================================================
// ART 8 - HEART
// ==================================================
void art8() {
tft.fillScreen(TFT_BLACK);
for(int r=70;r>5;r-=5){
tft.fillCircle(
130,105,
r,
TFT_RED
);
tft.fillCircle(
190,105,
r,
TFT_RED
);
tft.fillTriangle(
75,120,
245,120,
160,210,
TFT_RED
);
}
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(130,215);
tft.print("LOVE");
}
// ==================================================
// ART 9 - SPIRAL
// ==================================================
void art9() {
tft.fillScreen(TFT_BLACK);
float angle=0;
int px=160;
int py=120;
for(float r=1;r<115;r+=0.7){
angle+=0.18;
int x=160+cos(angle)*r;
int y=120+sin(angle)*r;
tft.drawLine(
px,py,
x,y,
tft.color565(
r*2,
255-r,
255
)
);
px=x;
py=y;
}
tft.setTextColor(TFT_CYAN);
tft.setTextSize(2);
tft.setCursor(125,215);
tft.print("SPIRAL");
}
// ==================================================
// ART 10 - MOUNTAINS
// ==================================================
void art10() {
tft.fillScreen(TFT_NAVY);
tft.fillCircle(
250,55,
25,
TFT_YELLOW
);
tft.fillTriangle(
0,210,
90,80,
180,210,
TFT_DARKGREY
);
tft.fillTriangle(
100,210,
210,60,
320,210,
TFT_LIGHTGREY
);
tft.fillTriangle(
210,60,
180,105,
235,95,
TFT_WHITE
);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(115,215);
tft.print("MOUNTAIN");
}
// ==================================================
// ART 11 - PLANET
// ==================================================
void art11() {
tft.fillScreen(TFT_BLACK);
for(int i=0;i<100;i++){
tft.drawPixel(
random(W),
random(H),
TFT_WHITE
);
}
tft.fillCircle(
160,120,
60,
TFT_BLUE
);
for(int y=-50;y<50;y+=15){
tft.drawLine(
110,
120+y,
210,
120+y/2,
TFT_GREEN
);
}
tft.drawEllipse(
160,
120,
105,
25,
TFT_ORANGE
);
tft.setTextColor(TFT_CYAN);
tft.setTextSize(2);
tft.setCursor(135,215);
tft.print("PLANET");
}
// ==================================================
// ART 12 - GEOMETRIC
// ==================================================
void art12() {
tft.fillScreen(TFT_BLACK);
for(int i=0;i<12;i++){
int x=random(20,300);
int y=random(20,200);
int s=random(10,50);
uint16_t c=tft.color565(
random(50,255),
random(50,255),
random(50,255)
);
if(i%3==0)
tft.drawRect(x,y,s,s,c);
else if(i%3==1)
tft.drawCircle(x,y,s/2,c);
else
tft.drawTriangle(
x,y,
x+s,y,
x+s/2,y-s,
c
);
}
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(100,215);
tft.print("GEOMETRY");
}
// ==================================================
// ART 13 - AI ROBOT
// ==================================================
void art13() {
tft.fillScreen(TFT_BLACK);
tft.drawRoundRect(
90,60,
140,120,
20,
TFT_CYAN
);
tft.fillCircle(
130,110,
15,
TFT_GREEN
);
tft.fillCircle(
190,110,
15,
TFT_GREEN
);
tft.drawLine(
125,145,
195,145,
TFT_CYAN
);
tft.drawLine(
160,60,
160,35,
TFT_CYAN
);
tft.fillCircle(
160,30,
7,
TFT_RED
);
tft.setTextColor(TFT_CYAN);
tft.setTextSize(2);
tft.setCursor(110,215);
tft.print("AI ROBOT");
}
// ==================================================
// ART 14 - ELECTRONIC CIRCUIT
// ==================================================
void art14() {
tft.fillScreen(TFT_BLACK);
for(int i=0;i<8;i++){
int y=30+i*25;
tft.drawLine(
20,y,
100,y,
TFT_GREEN
);
tft.fillCircle(
100,y,
5,
TFT_GREEN
);
tft.drawRect(
130,
y-8,
45,
16,
TFT_YELLOW
);
tft.drawLine(
175,y,
300,y,
TFT_CYAN
);
}
tft.setTextColor(TFT_YELLOW);
tft.setTextSize(2);
tft.setCursor(95,215);
tft.print("ELECTRONICS");
}
// ==================================================
// ART 15 - ARVIND PATIL AI CENTRE
// ==================================================
void art15() {
tft.fillScreen(TFT_BLACK);
// glowing concentric circles
for(int r=110;r>10;r-=10){
uint16_t c=tft.color565(
20,
100+r,
255
);
tft.drawCircle(
160,
105,
r,
c
);
}
// central AI symbol
tft.fillCircle(
160,105,
35,
TFT_BLUE
);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(3);
tft.setCursor(145,90);
tft.print("AI");
tft.setTextSize(2);
tft.setTextColor(TFT_YELLOW);
tft.setCursor(60,170);
tft.print("ARVIND PATIL");
tft.setTextColor(TFT_CYAN);
tft.setCursor(55,195);
tft.print("AI CENTRE NANDURBAR");
}Loading
esp32-2432s028r
esp32-2432s028r
https://wokwi.com/projects/479911014860442625