Hey
I wrote that patch, for my students in an interactive art class to use. It's derived from the excellent prior work of Thomas Ouellet Fredericks' SimpleMessageSystem.
All it does is:
- send an "r" to the Arduino
- The Arudino receives the "r" and executes a loop, reading all the pins and sending it back to Max.
- max receives the pin data and splits it up and sends it to "send" objects that make it available anywhere in MAX.
So as you can see, it would be
really easy to modify it. All you would do is replace the loop reading the pins with something else, and process that in MAX. The possible speed would be reduced 33%, as you are talking about 24 pins, rather than 18.
If you want to try it, just replace the code that reads the pins with code to read the 4051, and modify MAX to do the rest

See the template code below.
What do you have in mind exactly? We might be able to collaborate on it.
BTW, Arduino2MAX is implicitly released copyleft, so make sure any improvements you make give credit and keep it open and free for others to use! this means you can't wrap a "non-commercial" license around it, or at least you are asked not to, and that you are implicitly also asked to release your code and files. That way we can continue to have cool developments like the one you are proposing.
Thanks.
D
/*
* Arduino2Max
* Send pin values from Arduino to MAX/MSP
*
* Arduino2Max.pde
* ------------
* Latest update: September 2007
* ------------
* Copyleft: use as you like
* by djmatic
* Based on a sketch and patch by Thomas Ouellet Fredericks tof.danslchamp.org
*
*/
int x = 0; // a place to hold pin values
int ledpin = 13;
void setup()
{
Serial.begin(115200); // 115200 is the default Arduino Bluetooth speed
digitalWrite(13,HIGH); ///startup blink
delay(600);
digitalWrite(13,LOW);
pinMode(13,INPUT);
}
void loop()
{
if (Serial.available() > 0){ // Check serial buffer for characters
if (Serial.read() == 'r') { // If an 'r' is received then read the pins
// your code goes here. This is where you would prep the data
// by reading it with the 4051 etc.
sendValue (x); // this is the statement to send data to Max
Serial.println(); // Send a carriage returnt to mark end of pin data.
delay (5); // add a delay to prevent crashing/overloading of the serial port
}
}
}
void sendValue (int x){ // function to send the pin value followed by a "space".
Serial.print(x);
Serial.print(32, BYTE);
}