Easier streaming code - use the Streaming library


#1

For debugging, the serial port is invaluable. However, I find the repeated print() and println() method calls (one at a time) time consuming and a pain to change formatting. Instead, I’d rather have a compressed (concatenation - single line). I found the Streaming library solved the problem. You can learn more about it here. This library, along with using the Flash memory macro, has sped up my code->debug->code cycle.

It allows you to convert this:

lcd.print(" date: ");
lcd.print(day);
lcd.print("-");
lcd.print(month);
lcd.print("-");
lcd.println(year);

into:

lcd << " date: " << day << "-" << month << "-" << year << endl;


#2

Oooh cool. Could be a good pull request.

I am a big fan of the following format:
println(" date: " + day + "-" + month + "-" + year);

Is there an easy way to add that format? I know the format you share is much more standard C, but I like the model that Processing presents, just a personal bias.


#4

Check out Serial Port debug printing - library recommendation


#5

Added LogSerial class for printf and more ability in logging to the Serial Monitor. Details here: New LogSerial class