Serial.parseInt() takes longer time than desired
this is what you want:

void read() {
  for (i = 0; i &lt; 7; i++) {
    while (!Serial.available()); // wait forever for some input
    data[i] = Serial.parseInt();      
  }
  flag = 1;
}