Arduino Serial print changes behavior of program undesireably
Does your code initialise the serial port? Eg.
void setup()
{
Serial.begin(9600);
}
Failing to do this could result in a crash on first use of the serial.
Maybe you're running out of memory? All strings you print with Serial.print("something") take place in SRAM, equal to the number of characters of that string + 1 for the \0 terminator. It is possible to run out of memory even if your sketch's compiled size is much smaller than the Arduino flash memory, because SRAM is only 2048 bytes for Atmega328 and 1024 bytes for Atmega 168. I had a similar problem, which I solved by shortening all texts and removing unnecessary debug messages.
I also had a similar problem to this, and am very sure that yours is also out of stack space related. Try shrinking the code as much as possible.
In my case code would sometimes run when I had a serial message in it, but then it would seem to not run when I did not. I also had a case where sending serial messages would cause the arduino to reset endlessly.
I was also using an arduino328. Likely you should reduce the size of your array if you have any to the smallest size that is acceptable.