A simple library for adding debug lines to your code. When no longer required they can easiliy be removed for compilation.
DEBUGLEVEL determines the details to show. The higher the number the more is shown.
Download the library here.
Example 1:
#include <DebugUtils.h>
#define DEBUGLEVEL 1
void setup() {
#if DEBUGLEVEL >= 0
Serial.begin(115200);
#endif
DEBUGPRINT0("Level 0: ")
DEBUGPRINTLN0("I'm printed")
DEBUGPRINT1("Level 1: ")
DEBUGPRINTLN1("I'm printed")
DEBUGPRINT2("Level 2: ")
DEBUGPRINTLN2("I'm not printed")
}
void loop() {
}
Example 2:
#include <DebugUtils.h>
#define DEBUGLEVEL -1
void setup() {
#if DEBUGLEVEL >= 0
Serial.begin(115200);
#endif
DEBUGPRINT0("Level 0: ")
DEBUGPRINTLN0("I'm not printed")
DEBUGPRINT1("Level 1: ")
DEBUGPRINTLN1("I'm not printed")
DEBUGPRINT2("Level 2: ")
DEBUGPRINTLN2("I'm not printed")
}
void loop() {
}