error : overloaded 'println...

I am learning programming and stuck with this problem :

error: call of overloaded 'println(String (&)())' is ambiguous

the code is : myFile.println (String1);

1) String1 is declared as a String (before void setup) : String String1 ( ); 2) first there is a routine with data coming from the serial port. this data is assigned to String1. I can print this to the serial port but not to the SD card! 3) I don't see the difference!

code

// first routine : void setLED(char* data) { if (data[0] == 'a') { String String1 = (data); Serial.print("Mesung Start : "); Serial.println(String1); // no error !!!!!

// second routine : void Data1() { ////für SD Card ****************************************** String dataString = ""; myFile = SD.open("DatFile1.txt", FILE_WRITE); myFile.print("Start der Messung : "); myFile.println (String1); // error !!!!

}

/code

You most probably have a global String1 declared and you attempt to initialize it with empty brackets:

( re-read your post and it is the problem! )

String String1();

//Change to:

String String1;

You'r wright! That was the problem. What I don't understand is why can I send String1 to the serial port but not to the SD card (I marked out that line with the error code and the program is running)?

What I don't understand is why can I send String1 to the serial port but not to the SD card (I marked out that line with the error code and the program is running)?

Because Serial.print() has an overload to deal with crappy Strings and the SD class is smarter than to support useless Strings.

Get over it. Quit using Strings. They are NOT needed. EVER.