Serial Communication issues

So from what I've gathered from other forums serial.println, serial.print, and serial.write will all write out to the serial port. I've been trying to do some serial communication with a gumstix board. Just a basic set to 9600 baud rate, see if serial is available, read in what was sent from gumstix to arduino, print it out (the ascii chars, not int values) and then send a message back. I used to have a lot of other messages in this code which I would display with serial.println like "Setting baud rate to 9600" and "Serial is avialable" and "I recieved from gumstix:" but all those messages would also be written out to the gumstix and those messages would interfere with the last message that I actually wanted to be sent("sent from arduino to gumstix"). I read on some forums that serial.write was the only way to print out ascii chars that you read in from a stream, say data that was sent to me from the gumstix. What should I change in the sketch below to get it to just send out the message i want to send out to the gumstix, which is the buffer, and not all those serial.print statements as well? btw this is on a arduino uno board.


-----------------------------my sketch/code------------------------------------

int incomingByte = 0; // for incoming serial data const int buffer_size = 29; uint8_t buffer[buffer_size] = {"sent from arduino to gumstix"}; char input[100];

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

void loop() { //-----------------Serial Testing---------------------------// //receiving data: if (Serial.available() > 0){ // read the incoming byte incomingByte = Serial.read(); //input = incomingByte; * Serial.write(incomingByte);* * Serial.print("\n");*

  • }* //sending data:
  • Serial.write(45); // send a byte with the value 45*
  • int bytesSent = Serial.write(buffer, buffer_size); //send the string and return the length of the string.* }

Is the gumstix (whatever that is) connected to the same hardware serial port (pins 0 and 1 on Uno)? Which Arduino are you using? You should not have two devices connected to the same serial port without some way to identify which device a message is destined for. Set up a separate serial port for the gumstix (software serial on Uno, a different hardware port on Mega for instance.