Problem in uploading the code

I want to display this code on LED but it gives me too much errors

#include <TFT_eSPI.h>
#include <RTClib.h>

TFT_eSPI tft = TFT_eSPI(); // Create an instance of the TFT_eSPI library

// File structure
struct File {
String name;
bool isDirectory;
};

// Array of example files
File files[] = {
{"File 1.txt", false},
{"File 2.txt", false},
{"Folder 1", true},
{"Folder 2", true}
};
int numFiles = sizeof(files) / sizeof(files[0]);

// Current selected file index
int currentFileIndex = 0;

// Initialize the real-time clock (RTC)
RTC_DS1307 rtc;

void setup() {
tft.begin(); // Initialize the TFT display
tft.setRotation(3); // Adjust rotation if needed
tft.fillScreen(TFT_BLACK);

rtc.begin();
if (!rtc.isrunning()) {
rtc.adjust(DateTime(F(DATE), F(TIME)));
}
}

void drawDesktop() {
tft.fillScreen(TFT_BLACK);

// Draw file explorer
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setCursor(0, 0);
tft.println("File Explorer");
tft.setTextSize(1);
for (int i = 0; i < numFiles; i++) {
tft.setCursor(0, 24 + (i * 16));
tft.print(i == currentFileIndex ? "> " : " ");
tft.println(files[i].name);
}

// Draw clock
DateTime now = rtc.now();
tft.setTextSize(2);
tft.setCursor(0, 200);
tft.print("Time: ");
tft.print(now.hour());
tft.print(":");
tft.print(now.minute());
tft.print(":");
tft.println(now.second());

tft.updateScreen();
}

void loop() {
// Update the desktop
drawDesktop();

// Simulate a button press for demonstration
if (millis() % 5000 < 2500) {
currentFileIndex++;
if (currentFileIndex >= numFiles) {
currentFileIndex = 0;
}
}

// Delay for stability
delay(100);
}

I moved your topic to an appropriate forum category @ubaid12ur .

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

This is the second time I had to ask you to do this. Please start being more respectful of our community here.

Thanks in advance for your cooperation.

Actually I want to make a project with a touch screen, I want to make a desktop, a clock in it and also a file explorer in it. and I want to install this mini program in arduino board

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

thanks

And post those too.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.