[Solved] Bench with counting capabilities

Thank you for your post Nick, I had added an extra zero to the list of 'now's from the other post anyhow, but have switched to your code since it looks a little more reliable.

Excerpt from Serial Monitor:

now [i] =566
now [i] =888
flag is true

However when I remove the lines

    Serial.print ("now [i] =");
    Serial.println (now [i]); //debugging

I get no 'flag is true' printed. Similarly, if I place the print 'flag is true' piece of code here:

 if (flag) {
    digitalWrite(counterPin, HIGH);
    digitalWrite(13, HIGH); 		
    Serial.println ("flag is true"); // more debugging
  } 
  else {
    digitalWrite(counterPin, LOW);
    digitalWrite(13, LOW);	
  }
}

it works. However, in removing the

    Serial.print ("now [i] =");
    Serial.println (now [i]); //debugging

bit again, it stops working. Surely I don't need to be printing anything initially for this to work? This is all slightly academic anyhow, because the real test will be connecting it to an electromechanical counter, however if it's not going to produce 'HIGH' pulse unless I'm streaming data to a non-existent serial output, then it will be useless, and really I wanted to test the output behaviour in situations such as two or more LDRs being covered simultaneously.