Input Arduino Accelerometer Values into MAX

andres71's icon

Hi there,

Max Patch
Copy patch and select New From Clipboard in Max.

I´m trying to read the values of two 3-axis accelerometers into MAX. On one side I have both accelerometers and a wireless antenna connected to a an Arduino micro as transmitter to an Arduino UNO connected via USB to my computer. I do get a signal but I believe it´s a list that I can´t separate all going to the same number display (X axis in ACCELERATOR A). In a few words, what I need is to have each element of that list independent so I can see the separate values of each axis in the number displays at the end of the following patch:

I´d really appreciate any help on this.

pdelges's icon

What I gererally do in this case is using a different separator between the 3 values and between the triplets. On the arduino side, something like this:

Serial.print (accX);
Serial.print ("_");    // _ (ascii 95) used as a separator between the 3 values
Serial.print (accY);
Serial.print ("_");
Serial.println (accZ);    // \r \n (ascii 103 10) used as the triplet separator 
brendan mccloskey's icon

. . . and Steven Miller's solution here shows how you can parse such identifiers in Max:

Brendan

diablodale's icon

There exists libraries, arduino patches, which can make communication between Arduino and Max very easy.
Reference http://playground.arduino.cc/Interfacing/MaxMSP

andres71's icon

Thanks guys, I´ll check the Arduino libraries.