[SOLVED] help reading chars from XBee and populating array

Progress! :smiley:

After adding a null terminate to the string and more print statements, I'm getting one char into myArray[0] with the following code. I need to figure out why no more that one char is getting into the array. I'm sending only one char at a time from the terminal. The output I'm seeing looks like this:

Goodnight moon!
a
myArray>a<
b
myArray>b<
c
myArray>c<
1
myArray>1<
2
myArray>2<
3
myArray>3<

Here is latest code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3);  // 2=RX 3=TX

char myArray[20];

void setup()  {
  Serial.begin(9600);
  Serial.println("Goodnight moon!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(19200);
  mySerial.println("Hello, world?");
  // null terminate array
  myArray[0]='\0';
}

void loop()                     // run over and over again
{
  char c;
  int len=0;
  int i=0;

  // read from Xbee and write to term
  if (mySerial.available()) {
      c = mySerial.read();
      if(i<20) {
          myArray[i++]=c;
          myArray[i]='\0';
      } else {
          Serial.print("myArray= ");
          Serial.println(myArray);
        i=0;
      }
      Serial.write(c);
      Serial.println();
      Serial.print("myArray>");
      Serial.print(myArray);
      Serial.println("<");
  }   
  // read from term and send
  if (Serial.available()) {
      c = Serial.read();
      mySerial.write(c);
  }
  delay(100);
}