I am trying to replace all my Serial.print… used mainly for debugging by a call to a function which will be given also the verbosity level at which the text should be printed
instead of if(verbosity>2)Serial.print(“bla bla”), simply report("bla bla, 2);
with some function
report(char* text, int level) if (level>verbosity) Serial.print(text);
Can someone tell how to do this?
Thanks
[edit] and of course all these strings I need to print should be in program memory as
Serial.print(F(“bla bla”)) to save ram space
@Whandall: Thank you. I created a "report" function using your code, It works perfectly, saves me many tests and time printing and saves ram. Thank you