Toggling Debug Code

You don't even need:#define DEBUG 1 because:#define DEBUG
will suffice with a "#ifdef"

Better yet:

#ifdef DEBUG
  #define DEBUG_PRINT(x)  Serial.println (x)
#else
  #define DEBUG_PRINT(x)
#endif

Then you can liberally scatter your code with "DEBUG_PRINT ("I think I'm here");",
all controlled by a simple "#define DEBUG"

1 Like