Syntax

What is the syntax to write something like this.

Serial.println ("encoder 1: "),int(angle*(-1.8)),("encoder 2: ",(angle2*(-1.8)));

Wish were more examples in the Reference pages.

Thanks

What is the syntax to write something like this.

Like what? What do you expect that code to do? That is NOT how the comma operator is meant to be used.

If you are trying to print() a series of values, use a Serial.print() statement per value.

Exactly that. For example in the reference page explain that you can't concatenate in the print comand and stuff like that.

And if you want to print

Serial.print("I have "),apples, (" apples in the kitchen");

is
Serial.print ("I have ");
Serial.print(apples);
Serial.print(" apples in the kitchen");

Serial.print (F("I have "));
Serial.print(apples);
Serial.print(F(" apples in the kitchen"));

For example in the reference page explain that you can't concatenate in the print comand and stuff like that.

The reference pages are going to get very big if they explain all of the things that you can't do.

In any case, if you are determined to (or daft enough) you can concatenate in the print() command.

String Hello = "Hello";
String World = "World";
int number = 123;

void setup()
{
  Serial.begin(115200);
  Serial.println(Hello + " " + World + " " + (String)number );
}

void loop()
{}

But please don't do it !

Or you can use the streaming library
http://arduiniana.org/libraries/streaming/
and express output in the C++ stream fashion, e.g.

Serial << "I have " << apples << " in the kitchen";

aarg:
Or you can use the streaming library

or a little template...

template<class T> inline Print &operator << (Print &obj, T arg)
{
  obj.print(arg);
  return obj;
}

void setup() 
{
 Serial.begin(9600);
 int i = 3;
 Serial << F("I have ") << i << F(" banana") << (i == 1? F("\n") : F("s\n"));

// char phrase[20];
// sprintf(phrase, "I have %d banana%s", i, (i == 1? "\n" : "s\n"));
// Serial.print(phrase);
 
}

void loop() {

}

check it out with floats and compare its memory usage to sprintf....