/*******************************
https://chatgpt.com/share/d9e1433f-9b25-40fe-a042-b41120244a4e
*************************/
#include <Adafruit_ILI9341.h>
#include <SPI.h>
// Define SPI pins for ESP32
#define TFT_CS 5 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (can be connected or left unused)
#define TFT_MOSI 23 // SPI MOSI
#define TFT_SCLK 18 // SPI Clock
#define TFT_MISO 19 // SPI MISO (not used by the display)
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
#define WIDTH 320
#define HEIGHT 240
void setup(void) {
// Initialize the display
tft.begin();
tft.setRotation(1);
}
void loop() {
float scale[9];
for (byte i = 0; i < 9; i++)
scale[i] = (float)rand() / RAND_MAX / 4;
for (int y = 0; y < HEIGHT; y++) {
float ySin1 = sin(y * scale[1]);
float ySin5 = sin(y * scale[5]);
float yScaled2 = y * scale[2];
for (int x = 0; x < WIDTH; x++) {
float xScaled0 = x * scale[0];
float xScaled3 = x * scale[3];
float xyScaled4 = (x + y) * scale[4];
uint8_t r = 15.5 + 15.5 * sin(xScaled0 + ySin1);
uint8_t g = 31.5 + 31.5 * cos(yScaled2 + sin(xScaled3));
uint8_t b = 15.5 + 15.5 * sin(xyScaled4 + ySin5);
uint16_t rgb565 = b | (g << 5) | (r << 11);
tft.drawPixel(x, y, rgb565);
}
}
// Set the text color to yellow
tft.setTextColor(ILI9341_WHITE);
// Set the text size to 2 (adjust as needed)
tft.setTextSize(4);
// Set the cursor position (adjust as needed)
tft.setCursor(10, 110);
// Print the text "By Arvind"
tft.print("By Arvind");
}