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);
}