First of all, I'm still not that advanced with the arduino language, but we're starting to get along. Last week I have been trying to think of a way to read multiple datastreams from max/msp into the arduino, based upon the same principle that is explained in here: first sending an identifier and then the value.

I tried doing this in a couple of ways, for instance with trying to figure out how to deal with arrays in arduino's language. Didn't really work out.Now I just realized something while sitting outside in the sun, but I can't check it because my arduino isn't with me.

Is it true that Serial.read() reads and then erases the first int character it receives?

This example code only plays with leds, but that is not important. It would for me work with servo's that get their destination value from max: the val variable in here. (Max, ironically, gets controlled from an old atari2600 joystick that I've attached to the arduino itself, but I need Max to play with the values so a direct control through arduino is impossible )

I am workin on something similar. 2 suggestions:A- Use "while (Serial.available() > 1)" instead of "if (Serial.available() > 1)" (or the buffer could overflow)B- send ascii values for the integers instead of sending the raw numbers. This will give you more resolution and will ensure that "X" or "Y" do not get confused with the raw numbers.

You can check my work in progress on my Message lib here (it works): http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1149986873

From max you can send something like: "servo 5 1560" followed by a carriage returnThe Message lib will split the message so you can interpret it as three elements: servo,5 (pin 5) and 1560 (ms)

I couldn't really figure out what to do with all the codes you wrote, so I didnt get to use them.

However, I did get my code to work, partly. It seems there is a maximum of 3 units that I can use.The following is my complete code. It is supposed to work completely, but it only does if I either comment out the //servo 0:, //servo 1:, //servo 2: or //led0: part. If I dont (comment one out) the patch goes crazy and sends a constant mess of variables to max.