I would like to use a macro to enable selective turn on/off of certain lines of code that I might insert for debug purposes. One way to accomplish that would be to use a macro to insert a "//" prefix and turn that line of code into a comment.
Unfortunately I don't know how to define a "//" into a macro to accomplish that. The complier apparently assumes that the "//" is a comment for that line of code and not as an element of the #define statement.
frank2644:
Out of curiosity, is their a way to define "//" in a macro?
No. If you use '//' it is removed because it is a comment. If you try to paste it together from two separate tokens you get an error: "error: pasting "/" and "/" does not give a valid preprocessing token"
#define comment(a,b) a##b
comment(/,/) This is a comment?
With your DEBUG symbol defined, something like DEBUG_PRINTLN("Enter temperature unit conversion function") will be expanded to Serial.println("Enter temperature unit conversion function"), but without the DEBUG symbol defined the same line will expand to nothing and disappear.
One of the debug techniques I've adopted from another thread. I just added line number to the message. Actually made an include file with the definitions.