It keeps putting up the error even though i have tried to troubleshoot to fix the problem.
Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"
/Users/blank/Documents/Arduino/SD_Data/SD_Data.ino: In function 'void setup()':
SD_Data:63: error: expected '}' at end of input
}
^
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
SD_Data:63: error: expected '}' at end of input
exit status 1
expected '}' at end of input
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
#include <SD.h>
File myFile;
File myData;
File file;
void setup()
{
Serial.begin(9600);
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
if (SD.exists("num.txt")) {
}
else
{
myFile = SD.open("num.txt", FILE_WRITE); //TENTAR WRITE AND READ
if (myFile) {
Serial.print("Writing...");
myFile.println("0");
myFile.close();
Serial.println("Done.");
} else {
int num = 0;
if (myFile.available()) {
num = myFile.parseInt();
Serial.println(num);
num++;
int num2 = num;
// close the file
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
if (SD.exists("num.txt")) {
SD.remove("num.txt");
myFile = SD.open("num.txt",FILE_WRITE);
if (myFile) {
Serial.print("Writing...");
// close the file:
myFile.close();
Serial.println("Done.");
}
else
{
Serial.println("Error opening num.txt");
}
void loop();
{
}