uart problem can't receive


i trying send decimal number can't receive anything. here code send on 1 arduino:
code: [select]

// sends "a"s through serial port every second

// 'setup' function
void setup()
{
 // start uart @ 9600 bits-per-second (baud)
 serial.begin(9600);
}

// main loop
void loop()
{
 // print through uart
 serial.print(2);

 // pause 1 second
 delay(1000);
}




here receive other arduino:
code: [select]

int incomingbyte = 0;      // incoming serial data

void setup() {
     serial.begin(9600);      // opens serial port, sets data rate 9600 bps
}

void loop() {

     // send data when receive data:
     if (serial.available() > 0) {
           // read incoming byte:
           incomingbyte = serial.read();

           // got:
           serial.print("i received: ");
           serial.println(incomingbyte);
     }
}


any more welcome!! know simple problem. oh , have tx on 1 rx on other , vice versa.

do have common "ground" connection ?


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > uart problem can't receive


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums