title: Serial communication stuck after first attempt
body: <p>I am using arduino Mega 2560 to control some vibration motors with touchdesigner through Serial Communication. I maped the pixels to control each motors, It works for a few seconds and gets stuck very soon. Is there anything wrong with my code?</p>
  <p>Here is my arduino sketch:</p>
  <pre><code>#define MOTOR_COUNT 12
  int motors[MOTOR_COUNT];
  
  void setup()
  {
  
    Serial.begin(115200);
    Serial.println(&quot;Ready to receive frames.&quot;);
  
    for (int i = 0; i &lt;= 12; i++) {
      pinMode(i, OUTPUT);
    }
  
  
  void loop()
  {
    
    if (Serial.available())
    {
      char c = Serial.peek();
      if (!(c &gt;= '0' &amp;&amp; c &lt;= '9'))
      {
        Serial.read(); // Discard non-digit character
      }
      else if (Serial.read() == '\n')
      {
        for (uint16_t i = 0; i &lt; MOTOR_COUNT; i++)
        {
          motors[i] = Serial.parseInt();
          Serial.print(&quot;motor &quot;);
          Serial.print(i);
          Serial.print(&quot;:&quot;);
          Serial.println(motors[i]);
  
          if (i &lt;= 12) {
            analogWrite(i + 2, motors[i]);
          }
        }
      }
    }
  }
  </code></pre>