I have reduced the code down to the minimum to try and work out what is wrong but it always fails on "Compilation error: expected primary-expression before '==' token"
Post the whole code. You've obviously put the part you think is right. Now put the part where the mistake is. If you don't know what the mistake is then post the whole thing.
I'd bet money you've got a semicolon at the end of a #define.
Thanks for your suggestion. Actually I have tried all combinations of brackets.
Your version fails with "Compilation error: expected primary-expression before ')' token" It seems to me that it's the "primary-expression" which is the problem.
Thank you so much all. That was the problem. I had #define LOG_INTERVAL
instead of #define LOG_INTERVAL 15
Thanks again. I just couldn't see the problem which should have hit me in the face!
Not sure if will work correctly, tho. The condition will be true for a full 60 seconds, which could result in multiple updates to the log, unless you use millis() or delay() ( ) to avoid that.
You are right of course. I had cut down the sample of code as I was focussed on why the if wasn't working. My stupid mistake!
This is how the code is going to be structured.
if (currentTime.getMinutes() % LOG_INTERVAL == 0) {
if (!logged) {
//Log data
//logFile.print(currentTime);
//logFile.print(",");
//logFile.println(Temperature);
//logFile.flush();
Serial.print(currentTime);
Serial.print(",");
Serial.println(Temperature);
logged = true;
}
} else {
logged = false;
}