Good Afternoon everyone,
i'm pretty new to Arduino, but i know a bit of C, i have a problem with my code
(btw, Arduino Ethernet, using a 32GB microSD, i do write and read without problems)
CODE:
// i open the sd correctly into the setup(), i do use SDFat.h,
void loop()
{
if (!myFile.open("stato.txt", O_WRITE | O_CREAT | O_AT_END)) sd.errorHalt("opening logging file for write failed");
if (myFile.isOpen()){
// }
k++;
}
}
i wanna write when k is 100,200,300 ecc.
the problem is that if i insert the commented code, the file won't even open.
how can a the "2nd if" stop the file from opening?
if i comment the k%100 condition the sketch writes correctly
if i try to open the file I see
0;437;168
0;437;168
meaning that k isn't incremented but it actually cycles 2 times before he stops writing.