serial connections

Hello, I am trying to send serial data from an UNO (pin 0 , pin1) to a Mega Serial1. No luck so far. I have Rx to Tx and Tx to Rx. Both baud rates are the same. I tried connecting the grounds together to see if that was the problem. The code on the reciever (mega) looks like this:

loop(){ while(! Serial1.available){ // just wait } while(Serial1.avaiable){ int input =; delay(60); Serial.println(input); }

If it matters both are powered by the USB. -Steve

sbennett1298: I tried connecting the grounds together to see if that was the problem.

Good, since the ground connection is required.

Does the output from the Arduino show up on Serial Monitor? That would be a good first step.

Just to be let's post all of the code from both sides. (And please use code tags)

just as a simple test, you could try the below code on both the uno and mega. Disconnect the wire between the uno rx pin and mega tx pin to prevent interference during the test, then send something using the uno serial monitor and see if it is echoed back to the uno serial monitor and appears on the mega serial monitor.

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.println("serial test 0021"); // so I can keep track of what is loaded

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c =;
    readString += c;

  if (readString.length() >0) {


Thanks everyone. Another case of cockpit error. To begin with I didn't realize the grounds needed to be connected between the two Arduinos. After correcting that I still had another problem. I had the serial port numbers mixed up. I assumed Serial1 was on the lower numbered pins and Serial3 was on the higher numbers. WRONG. Funny how things suddenly work when you RTM. :blush: -Steve