Hi,
This is probably a stupid question, but I couldn’t find a solution.
I would like to activate / deactivate a debug function of a library (basically print some information on the serial interface) from an adruino sketch.
So in the library (let’s say LIB.h) I have defined:
#ifndef LIB_h
#define LIB_h
#ifndef DEBUG
#define DEBUG 0
#endif
….
if (DEBUG) Serial.println (“hello”);
…..
#endif
Now in my sketch I would like to turn the debug mode on staring my sketch with:
#define DEBUG 1
#include <LIB.h>
……..
void setup() {
Serial.begin(9600);
….
}
But this doesn’t work (defining DEBUG 1 or 0 is not recognised by the library).
How can I solve this problem?
Thanks in advance
Robert