I have a problem with creating aan image displayer but I having problem with it. I want to display jjpg images, I am not a skilled programmer so I asked chatgpt to write me a code for this project, but none of the codes worked. I uploaded the images onto the esp32s3 wiwith an older version with arduino (ESP32 Sketch Data Upload). Here is the code: #include <TFT_eSPI.h>
#include <TJpg_Decoder.h>
#include "SPIFFS.h"
TFT_eSPI tft = TFT_eSPI();
const char *jpgFiles[] = {"/1.jpg", "/2.jpg", "/3.jpg", "/4.jpg"};
const int numJpgFiles = sizeof(jpgFiles) / sizeof(jpgFiles[0]);
bool jpegRender(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t *bitmap) {
if (y >= tft.height()) return false;
tft.pushImage(x, y, w, h, bitmap);
return true;
}
void setup() {
Serial.begin(115200);
delay(1000);
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
Serial.printf("Display size: %dx%d\n", tft.width(), tft.height());
if (!SPIFFS.begin(true)) {
Serial.println("SPIFFS Mount Failed");
while (1);
}
Serial.println("SPIFFS mounted. FFiles");
File root = SPIFFS.open("/");
File file = root.openNextFile();
while (file) {
Serial.println(file.name());
file = root.openNextFile();
}
TJpgDec.setCallback(jpegRender);
TJpgDec.setJpgScale(1);
}
void loop() {
for (int i = 0; i < numJpgFiles; i++) {
Serial.printf("Drawing %s\n", jpgFiles[i]);
tft.fillScreen(TFT_BLACK);
if (TJpgDec.drawFsJpg(0, 0, jpgFiles[i], SPIFFS) != 0) {
Serial.println("cant show the image");
}
delay(10000);
}
}
Every help will appreciated.