I am working on a sound installation which contains at least a few dimmable leds, four servos, a motion detector (ePIR) and an eight channel relay board. This is going to be controlled through max/msp. We've tried Maxuino but it's incredible unstable with my Mega 2560, and we've come to realize that it's quite simple to use the serial connection with a simple customized code for the arduino, that's not a problem.
Now the question is how to send the data streams from Max to Arduino. The simplest way for a max-head like me would be to [prepend] a channel number for every unique data stream (that creates a two number list in which the first is the channel number and the second is unique data), and then in a, ehm, perfect word, be able to use an object similar to [route] in the arduino to strip the first number (the channel number) and then send the second to the the assigned variable. I dont know if this is how you do it at all and I'm a bit amazed that I haven't been able to figure it out myself.
I would be very grateful if someone could point me to the right direction. I've tried to understand how one could do this with Switch/Case but I'm not really into C, at all. Someone mentioned to use a msb/lsb bit technique, but I dont know much about that either. The way we have it now is to simply use range of whatever controller we're using and then add a >= 0, <=255 in arduino to pick out the data, but it will be seriously complicated as the patch grows and whenever you need to change something.
By the way does anyone know if there's anythink I should think of when configuring the
[serial] object in Max?
Thank you for your time.
Trrg