Serial communication

Hi all, I´m developing a project where I will use this board to controll a lot of Servos using Arduino Mega [u]http://www.robotshop.com/dagu-spider-robot-controller-2.html[/u]

The "problem" is that The incoming data to move the servos are generated by Max MSP; so I have 2 options, communicate them via Serial or OSC (maxuino only gives 15 output maximum). It seems not easy like in processing is to arduino to receive data via OSC, so I´m guessing about communicate them via Serial.
What I´m really asking is; How can I receive more than one value via Serial, I have to receive a String and then split it to get the different incoming values? Can I create a function to each value to parse it automatically?

I hope I´m explaining correctly :slight_smile:

Define start, stop and delimiter characters to identify your stream of data. So start with the start character, send the first value, send the delimiter, then send the next value. Do so till you have sent all values, after that send the stop character. This way you know on the receiving side where the data starts, when the next data value starts and where the whole message is finished. If you search in the forum you'll find dozens of examples.

The incoming data to move the servos are generated by Max MSP

Do you have any documentation describing the format of the serial data?

You can have very simple serial communications where each individual character is an instruction.
For example you might just send the characters '0'....'9' and, depending on what character was sent you could do one of the 10 options.

You can have more complex communications protocols where you send strings of characters that need to be parsed to determine the meaning of the message.

I suggest you try practicing sending characters to your arduino.