Problem with the call and response max/arduino example …

Apr 21, 2012 at 9:10pm

Problem with the call and response max/arduino example …

Hi,

I have made the following max / arduino tutorial: http://arduino.cc/en/Tutorial/SerialCallResponse

Yes, it works, the sensor data comes out into the three number boxes, but there is a problem:
- everytime I hook up the arduino, the sensor signals appear in different number boxes. This means that I need to find out which sensor comes out into which number box, everytime I boot max.

My question is: How do I make sure that the sensor signal from A1 is routed into the first number box, the sensor signal A2 is routed into the second number box etc, everytime I open max?

Thanks for your help!

K

#63134
Apr 21, 2012 at 9:25pm

Hi
prefix each sensor with a unique ID:

Serial.print(“1″);//ascii 49
Serial.print(yourOwnSensorValueHere, BYTE);
Serial.print(“2″);//ascii 50
Serial.print(anotherSensorValueHere, BYTE);

etc

then in Max use a combination of [zl group 2] and [route 49 50]. This very short video of mine explains how:

https://www.youtube.com/watch?v=l2ZU9RG6y1M

just replace the random val1, random val2 etc with your own sensor values

Brendan (fCast)

#227826
Apr 24, 2012 at 12:55am

The reason this is happening is because the Arduino is pinging the attached computer waiting for a serial port to open, there’s a byte sitting in the buffer, causing everything to shift over one.

Thanks for pointing this out, I’ll address it for the next Arduino software release.

#227827
Apr 24, 2012 at 1:24am

Here’s a patch that addresses the issue for that specific example. If you have trouble, please let me know.

– Pasted Max Patch, click to expand. –
#227828

You must be logged in to reply to this topic.