I'm making some code for school, and is adding debug code to it. When compiling, I get the error as written in the title. This is the code in question:
#define DEBUG 1
#ifdef DEBUG
#define Serial.println(x) DEBUG_PRINT(x)
#else
#define DEBUG_PRINT(x)
#endif
And the code in my void setup, which has Serial.begin:
#ifdef DEBUG
Serial.begin(9600);
DEBUG_PRINT("Asteroid");
#endif
What am I getting wrong? I get the feeling it's my define text, but I'm unsure.
Thank you for your time Gaarden
.
. Thus you cannot define a macroSerial.println(x)
. You probably wanted to define it the other way around anyway.#define DEBUG_PRINT(x) Serial.println(x)
;