Serial.println () gibberish

I have written a relatively long sketch using Serial.println () that is based on a previous sketch that works perfectly. However, the newer sketch returns gibberish in most cases rather than the requested text. All of the problem spots are relatively basic as noted below. Am I missing some obvious solution to this problem?

I simply do not see any difference between the sketch that works and this one.

Baud rate was set at 9600. I have tried higher and lower rates and matched the serial monitor setting and the rate in the sketch. I have scoured the forums and can’t find an obvious answer.

Thanks in advance. Sample from beginning and end the new sketch:

void loop() 
{
 //arduino waits for input
 if (Serial.available() > 0);
 {
   char letter = Serial.read();

   if (letter == 'a')

   { 
     Serial.println ("stim series a. ON 125 ms; ISI 250 ms");
     Serial.println ("TOP, MID, BOTTOM row, 3 sec between rows");

     digitalWrite(ermPin4, HIGH);  
     delay(125);                  
     digitalWrite(ermPin4, LOW);  
     delay (250);

// more code here

digitalWrite(ermPin11, HIGH);  
     delay(125);                  
     digitalWrite(ermPin11, LOW);  
     delay (100);
     Serial.println ("correct answer: DOWN");
     digitalWrite (ledPin, HIGH);
     delay (6000);
     digitalWrite (ledPin, LOW);
       delay (1000);

     Serial.println ("* * *");
     Serial.println ("Just ran series i");
     Serial.println ("* * *");
     Serial.println ("Waiting for input");
     Serial.println ();
   }
 }
}

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

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

Sample from beginning and end the new sketch

Since you did not post ALL of your code, we can’t compile it to see what you are seeing. All we CAN do is wish you luck solving the problem. So, good luck.

fprete:
I have written a relatively long sketch using Serial.println () that is based on a previous sketch that works perfectly. However, the newer sketch returns gibberish in most cases rather than the requested text. All of the problem spots are relatively basic as noted below. Am I missing some obvious solution to this problem?

I simply do not see any difference between the sketch that works and this one.

Well, I see nothing wrong with your code. What serial terminal are you using to view the Arduino output?

Is your com port set properly (that is, 9600 baud, 8 bits, no parity, 1 stop bit)? (also known as "8N1").

Try using a different terminal program and see if it works then.

Serial.println ("Just ran series i");

Speaks of being too prolix.

Give it some more F() Serial.println (F("Just ran series i"));

fprete:
I have written a relatively long sketch using Serial.println ()

Constantly check that the program works before it gets long.

...R