Arduino to Arduino Serial troubles

I am currently using ladyada’s NewSoftwareSerial library to communicate with my Touchshield slide, which I have attached to my arduino Mega. Here is the code on the Mega:

#include <NewSoftSerial.h>

NewSoftSerial touchShield = NewSoftSerial(3,2);

int counter = 0;

void setup(){

void loop(){
  touchShield.println("Hi Touchshield!");

And here is the code on the Touchshield:

int marker = 0;

void setup()

void loop()
  char string[128];
  char byteRead;
  int availableBytes = Serial.available();
  for(int i=0; i<availableBytes; i++)
      byteRead =;
      if (byteRead == '\n') break;
      string[i] = byteRead;
      string[i+1] = '\0'; // Append a null
  text(string, 2, marker);
  marker = marker + 10;
  if (marker > 360) {
    marker = 0; 

Here is the output:

What can be the problem? I’ve tried making the buffer smaller, larger, etc. I also can’t decrease the baud rate, as eventually I hope to interface this with other sensors which communicate at 57600, and the NewSoftwareSerial library states that it can handle this baud.

My first guess is that you are overrunning the serial input buffer on the touchshield side. Try putting a delay(500) between sends. If all the messages appear correctly, reduce the delay until problems occur. That will give you an idea of how fast you can process data. You can't send data faster than the receiver can process it forever.

Your Mega has 4 hardware serial ports. Why do you need to use NewSoftSerial on the Mega?

Are you using that version that was modified to work on the Mega? Are you using pins that NewSoftSerial can work on, on the Mega? No, you are using hardware serial pins? Why?

That did the trick. I guess I'm overflowing the buffer while the receiver is updating the screen. I dialed the delay between writes to 50 to get consistent results.

Is there any way to increase the size of the buffer?

The touchshield headers only fit the standard arduino footprint, which is digital pins 1-13 and the analog pins. The serial pins are below those (pins 14-19), and resoldering the header would interfere with the positioning of the lcd screen, something I don't want to play with as the screen cost 175$ >_>

The touchshield headers only fit the standard arduino footprint, which is digital pins 1-13 and the analog pins.

Technically, that's 0 to 13...

You could jumper from 2 and 3 to a hardware serial port, and use Serialn.print(ln), instead of NewSoftSerial, which would allow you to increase the baud rate, which would allow you cut down on the delay.