I've this code:
Serial.print("x:");
Serial.print(x);
Serial.print(" y: ");
Serial.println(y);
and works fine. There's an example of the output:
x:41 y: 31
but I wonder if there's a way to write the four sentences in one with something like:
Serial.println("x:"+x+" y:"+y);
that returns an error:
invalid operands of types 'const char*' and 'const char [4]' to binary 'operator+'
Any idea?. Thanks in advance.
There is a quicker way: Just convert your output directly to a String:
Serial.println((String)"x:"+x+" y:"+y);