Forums > MaxMSP


October 5, 2010 | 8:49 am

I am having trouble with getting my Arduino Mega to work with ALL the pins. I have been using "Arduino2MAX_V.4". This is the link:
….. BUT I cant get the analog pins to work with max beyond pin # 5.
I have posted help also here:

October 5, 2010 | 2:35 pm

are all the analog inputs enabled in the arduino code? You might have the script for a smaller arduino uploaded to the mega.


October 5, 2010 | 3:01 pm

The code example you linked to (adafruit):

void loop()

if (Serial.available() > 0){ // Check serial buffer for characters

if ( == ‘r’) { // If an ‘r’ is received then read the pins

for (int pin= 0; pin< =5; pin++){ // Read and send analog pins 0-5
x = analogRead(pin);
sendValue (x);

for (int pin= 2; pin< =13; pin++){ // Read and send digital pins 2-13
x = digitalRead(pin);
sendValue (x);

does not appear, as you say, to be altered to read all pins; but even changing this may not allow you to read all pins if the Arduino2Max patch is not set up to parse data from all pins. If you have changed the Arduino code to read all pins and the problem persists then you’re going to have to also change the Max patch, if it’s open-able?
The poster above is right, you’ve probably got hold of a patch and some code that was designed for the Duemilenova-type board.

October 5, 2010 | 4:28 pm

Yes this code is for a normal Arduino … This is NOT the changed code. This is what I changed:

for (int pin= 0; pin< =15; pin++){ // Read and send analog pins 0-5
x = analogRead(pin);
sendValue (x);

BUT I cannot find code anywhere for a Mega to Max

October 5, 2010 | 4:48 pm

Can you open and edit the Max patch?

October 5, 2010 | 6:27 pm


October 5, 2010 | 7:13 pm

Ok, then you should post a stripped down version of the unlocked original patch (assuming you’ve already done some tinkering with it).

I’m guessing that, given your changes to the Arduino sketch, the problem lies in the Max patch.

Would you describe yourself as a beginner/intermediate/advanced Max5 programmer?


October 5, 2010 | 7:35 pm

Max5 … Beginner // Arduino … intermediate. I am able to edit the patch in Max but im not sure how / if it is possible to go further down to the "code" level

October 5, 2010 | 7:49 pm

let’s have a look at the patch then……..if it’s not locked and uneditable, as is an exernal object or bpatcher, it should be fairly straightforward to extend the Max patch to include your additional inputs.

BTW just out of curiosity, how many analog inputs do you need and what are you using them for?


October 5, 2010 | 8:29 pm

SUCESS !!!! I edited the Max patch within the other patch and everything is working !!! Thanks for your help….

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

Forums > MaxMSP