Here are several things I can see from your code that cause most of the error messages.
1) You declare
File data_txt;
File data2_txt;
but you later use data_file
and data_file2
. This is why you see the "not declared in this scope" errors.
2) You do not properly define the functions getData()
and getData2()
. You start with the definition of getData2()
inside the function getData()
.
First finish the function getData()
by closing all brackets you opened and then define the function getData2()
, like this:
void getData() {
//the code of getData() goes here....
}
void getData2() {
//the code of getData2() goes here....
}
3) I assume you want to write to data_file
in getData()
and to data_file2
in getData2()
?! Nevertheless, you also use data_file
in getData2()
.
Update after your edit:
Regarding the compilation error, you do not open a curly bracket
{
after getData2()
.
However, there are several other issues that will lead to problems, even if it finally does compile without problems.
#include <SD.h>;
;
. it should be#include <SD.h>