I recently came across this line of code , which someone sent:
#define _DEBUG_ //This allows debug logging over the serial port.
It spits out debug info on the serial port - am curious since I have not seen this before.
I am using a MKR GSM 1400 - connecting to Thinger.io
Where can I read more about this?
thanks
Russell
All that line does is to define a macro named DEBUG
Later in the code you can test whether it is defined and take action depending on the test
#define _DEBUG_
void setup()
{
Serial.begin(115200);
while (!Serial);
#ifdef _DEBUG_
Serial.println("_DEBUG_ is defined");
#endif
}
void loop()
{
}
It provides a mechanism for turning debugging output on and off by changing one line of code
Note that the macro might as well be named FRED for all the difference that it makes
Thanks for that - will check that out
[edit] - I can't see where the macro is defined anywhere in the code.
I added it to my MKR code and it also works. I think the macro is defined in the ThingerMKRGSM library