Forums > MaxMSP

Problem with the call and response max/arduino example …

Apr 21 2012 | 9:10 pm


I have made the following max / arduino tutorial:

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!


Apr 21 2012 | 9:25 pm

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);


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

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

Brendan (fCast)

Apr 24 2012 | 12:55 am

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.

Apr 24 2012 | 1:24 am

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

Viewing 4 posts - 1 through 4 (of 4 total)

Forums > MaxMSP