Skip to content
Albert van Dalen edited this page Aug 8, 2024 · 2 revisions

Here is a handy solution that makes it easier to print multiple variables one after the other, using a comma separator. Can this be integrated? I use it a lot..

`#include <Streaming.h>

template inline Print &operator ,(Print &stream, const T arg) { stream.print(" "); stream.print(arg); return stream; }

int a, b, c, d, e, f;

void setup() { Serial.begin(115200); Serial << "\nData: " << a, b, c, d, e, f; // instead of: Serial << "\nData: " << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl; }

void loop() {
}`

Clone this wiki locally