Let's Make Robots!

TX2,RX2 on SPIDER board

I am using SPIDER for next project to run 30 servos plus XBEE with voice/sound control.

Never work with 2nd TX/RX port on Arduino before and not to sure if I do this correctly. I have search on web and see how it should be setup in any easy I could understand and following code is what I found and modified a bit to start of:

#define sndSerial Serial1

void InitSnd(void){
    sndSerial.begin(9600);
}
void setup(){
  Serial.begin(9600);
  InitSnd();
}
void loop(){
  Serial.println("Serial");
  delay(500);
  sndSerial.println("Sound");
  delay(500);
}

The result only shows "Serial". Wondering which part goes wrong and hope anyone could give me a hand. Thank you!!

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This is what I got in pde:

void setup(){
  Serial.begin(9600);
  Serial1.begin(9600);
}
void loop(){
  Serial.println("Serial");
  delay(500);
  Serial1.println("For Sound...");
  delay(500);
}

I can only see "Serial Serial Serial..." but no "For sound...". Should I define it ?

Are you trying to read both of these througt the normal serial port? I am confused how you are set up to read what is being sent. If you are just using a single cable to your computer or multiple.

Thanks for help. I tried that but same. only "Serial" came up but not "Sound". Seems like Serial1 is not working. Should I enable that timer or something? Maybe I missed something?

a google search turned up Serial1.begin() rather than sndSerial.begin()

 

void setup(){

  Serial.begin(9600);

  Serial1.begin(9600);

}

 

void loop(){

  Serial.println("Serial");

  delay(500);

  Serial1.println("Sound");

  delay(500);

}

 

Might I add that I have never seen trying to name the serial port something other than Serial, Serial1, ect... (Besides with software serial)