When there is an error in compiling, a button will appear in the lower right of the IDE window. it is labeled "copy error message". Copy the error message and paste into a new post. Paraphrasing error messages leaves out important information.
Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
I've changed the name and still get the same error.
Can't help if we don't know what you did. Always post the new code so that we can keep up.
If you want to save output of rtc.getDOWStr(), rtc.getDateStr(), tc.getTimeStr() you need to write them separately. The RTC() function only calls those functions, it does not take on their values.
I've changed the name of the void function and i still get the same error.
I've also tried to leave only rtc.getDOWStr(); and i still get the same error.
Here is the part of the code where i changed the name of the void function.
when you ask the compiler to do: myFile.print(clocktime());
you are asking to print whatever is returned by the call to clocktime().. but since it does not return anything (its return type is 'void', ie nothing), there is nothing to print.
if you were to do a
Serial.print(rtc.getDOWStr());
then you would likely see something (and you would do the same with rtc.getDateStr() and rtc.getTimeStr())
Similar to what groundFungus replied while I was writing it, but there are some differences so I'll post it anyway:
Changing the name of the function isn't going to help. The problem is that the clocktime function doesn't return anything, so there's nothing to print to myFile, thus the error.
I'll give a simplified example, here's a function named myFunction that returns a byte:
byte myFunction() {
return 42;
}
Now I can use the function like this:
myFile.print(myFunction());
which is the equivalent of:
myFile.print(42);
But your clocktime function returns a void, so your code:
myFile.print(clocktime());
is the equivalent of:
myFile.print(void);
which is not valid code, and wouldn't be useful even if it were.
I guess you think your code is going to work something like this:
OK, that's good, but I do hope you'll also take the time to learn how functions work. Even if you don't need the knowledge for this specific project, functions are incredibly useful.
pert:
OK, that's good, but I do hope you'll also take the time to learn how functions work. Even if you don't need the knowledge for this specific project, functions are incredibly useful.
Thanks for the tip. I will spend some time learning them. Thank you.