Diashow code not working, full with errors

I am trying to make a diashow on my Mega 2560 with an ili9488 display
here is the code, maybe you can help me:
void setup() {
// put your setup code here, to run once:

}
void loop() {
// put your main code here, to run repeatedly:

}

#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_SdRaw.h>

#define SD_CHIP_SELECT 53 // SD chip select pin(Arduino Mega)
SdFat sd;

UTFT myGLCD(ILI9341_16, 38, 39, 40, 41);
UTFT_SdRaw myFiles(&myGLCD);

Serial.begin(115200);
delay(100);
bool mysd = 0;
while (!mysd)
{
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED))
{
Serial.println(F("Card failed, or not present"));
Serial.println(F("Retrying...."));
}
else
{
mysd = 1;
Serial.println(F("Card initialised."));
}
}
Serial.println(F("Initialising LCD."));
myGLCD.InitLCD();
myGLCD.clrScr();
}

void loop()
}
#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_SdRaw.h>

#define SD_CHIP_SELECT 53 // SD chip select pin(Arduino Mega)
SdFat sd;

UTFT myGLCD(ILI9341_16, 38, 39, 40, 41);
UTFT_SdRaw myFiles(&myGLCD);
void loop() {

Serial.begin(115200);
delay(100);
bool mysd = 0;
while (!mysd)
{
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED))
{
Serial.println(F("Card failed, or not present"));
Serial.println(F("Retrying...."));
}
else
{
mysd = 1;
Serial.println(F("Card initialised."));
}
}
Serial.println(F("Initialising LCD."));
myGLCD.InitLCD();
myGLCD.clrScr();
}

void loop() {

myFiles.load(0, 0, 320, 240, "rx7.RAW", 1, 0);
while(1);
delay(4000);
myFiles.load(0, 0, 320, 240, "auto.RAW", 1, 0);
delay(4000);
myFiles.load(0, 0, 320, 240, "dodge.RAW", 1, 0);
delay(4000);
myFiles.load(0, 0, 320, 240, "miata.RAW", 1, 0);
delay(4000);
myFiles.load(0, 0, 320, 240, "ka.RAW", 1, 0);
delay(4000);
myFiles.load(0, 0, 320, 240, "hellcat.RAW", 1, 0);
delay(4000);
myFiles.load(0, 0, 320, 240, "mazda.RAW", 1, 0);
delay(4000);

}

Did you install the libraries that you have #included?

yes i did, i have that from a youtube tutorial: Display Images on TFT Using Arduino Tutorial - YouTube
the current error says: 'serial' does not name a type

You mean, "Serial"?

Why do you have two setup() and two loop() functions? Not cool.

i copied that code from the internet, what should i do now

That's not good.

Please remember to use code tags when posting code

Stop copying code from the internet.

1 Like

okay, im new here

okay, but can you help me with this one?

I did. Fix the problem I identified for you.

Looks like you have cut and paste issues. There is code outside of functions, #includes within function, etc. You have loop() defined a total of 4 times. I can't even begin to sort it out.

1 Like

okay so what should i do now, can you give me clear instructions?

You have one setup function and one loop function.
No more, no less.
You can have other functions but you must have these two.
Code other than variable declarations and definitions must be in a function.

ok im gonna try it

This might be a long topic at this rate...

so, i got my arduino 3 days ago and i dont know how to set the code right, can someone do it for me?

Where's the fun in that?

1 Like

i just want it for my desktop..

Huh?

If you follow the links to the code on the YouTube site, you can reach this:
https://drive.google.com/file/d/10CYaEh836Z2VFlFQ67YBCVWhr2NSC5Zx/view
The .ino files and images are there. You just need to slow down and follow instructions...