TinkerKit Master Shield + Max For Live + Arduino Uno

Hello all!

So I am working on a project right now and need to send 12 channels of DMX out to four lights. I’ve managed to achieve this by creating a custom M4L patch that receives automated slider data from Ableton, converts said output to necessary syntax to work with the DmxSimple SerialToDmx example code, and sends the converted message out via serial.

(see attached for image)

Here is my problem. After a seemingly consistent amount of messages sent out of Max, everything hangs up, freezes, and I need to unplug and restart everything in order to continue usage.

Could someone provide me any sort of insight as to whether or not this is an issue with my Max patch, or if there is some sort of issue with the Arduino code and or Master Shield…?

Am relatively new to all of this, so any and all suggestions / advice will be hugely appreciated.

Here is the Arduino code that I am using.

#include <DmxSimple.h>

void setup() {
 DmxSimple.usePin(3);
 Serial.begin(9600);
 DmxSimple.maxChannel(12);
}

int value = 0;
int channel;

void loop() {
 int c;

 while(!Serial.available());
 c = Serial.read();
 if ((c>='0') && (c<='9')) {
   value = 10*value + c - '0';
 } else {
   if (c=='c') channel = value;
   else if (c=='w') {
     DmxSimple.write(channel, value);
     Serial.println();
   }
   value = 0;
 }
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Please do not cross-post. Other thread removed.

sorry, i figured that this post was relevant to the other forum topics as well. am just looking for some help.