I'm writing a code and I can't use a String as parameter of a function, the Arduino keeps resetting. This is my original code thad do not works:
Serial.print(readLine("routes.txt", 1)); // calling the function
String readLine(String fileName, unsigned int lineNum)
{
if (!SD.exists(fileName))
{
Serial.println("- " + fileName + " do not exists!");
return ("FAILURE");
}
[continue the code...]
This code works:
Serial.print(readLine(1)); // calling the function
String readLine(unsigned int lineNum)
{
if (!SD.exists("routes.txt"))
{
Serial.println("- " + "routes.txt" + " do not exists!");
return ("FAILURE");
}
[continue the code...]
Anyone to help me?