Hi Daniel,
nice Max/Msp patch.
I spotted 2 minor errors in your Arduino SimpleMessageSystem code:
You set the value for secondChar(secondChar = messageGetChar()

, but you do not use that variable. In the same section of code, you have a comment that states that the next character has to 'b' to continue, but that is not true as there are no curly braces to indicate the code to execute if the statement is true. It should be something like:
...snip...
if (secondChar = 'd') { // The character has to be 'd' to continue and read the sensors
messageSendChar('d'); // Echo what is being read
for (int i=0;i<=5;i++) {
messageSendInt(analogRead(i)); // Read analog pins 0 to 5
}
for (int m=2;m<=13;m++) {
messageSendInt(digitalRead(m)); // Read digital pins 2 to 13
}
messageEnd(); // Terminate the message being sent
delay(9);
}
...snip...
Also, since you are controlling the rate of querying the sensors in Max/Msp there is no real need for the delay(). Simply limit the metro in Max/Msp to 10 ms. Why? You are sending from the Arduino board a list that can contain up to 56 ascii characters and, at 115200 baud rate, that can take about 5.4 ms to transfer (I think), so 10 ms gives a bit of time to settle.
One final comment: since you are querying all sensors simultaneously, you do not need to put headers to your query and answer.
i.e.: To query the sensors you could use only one character. For the answer, you do not need any. Something like this:
...snip...
if (secondChar = 'r') { // The next character has to be 'r' to continue and read the sensors
//(This can be removed with the updated SMS lib, see below) messageSendChar('d');
for (int i=0;i<=5;i++) {
messageSendInt(analogRead(i)); // Read analog pins 0 to 5
}
for (int m=2;m<=13;m++) {
messageSendInt(digitalRead(m)); // Read digital pins 2 to 13
}
messageEnd(); // Terminate the message being sent
}
...snip...
The code above only works with the new SMS lib (and a slightly modified Max/Msp patch where the route is removed), as stefan kersten noticed that I had left some debug statements that would send the size of the buffer through the serial connection. That was corrected and uploaded.
Tom