Pages: [1]   Go Down
Author Topic: Serial communication  (Read 255 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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 smiley
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Pages: [1]   Go Up
Jump to: