however, when i send back some letters, the ardunio could not receive.
// to see if mega2560 recieve anything from the computer
if (Serial1.available()){
Serial1.println("");
int aaa = Serial1.read();
Serial1.println(aaa);
delay(500);
digitalWrite(13, HIGH);
}
actually i received some random number for the variable "aaa" and the LED always turned on.
The fact that the LED comes on and you get numeric character codes displayed means that your Arduino DID receive data from the PC. Perhaps you should look for characters more often than once per second:
void setup() {
Serial1.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Serial1.println("Waiting Signal....");
}
void loop() {
// If mega2560 recieve anything from the computer, echo it back
if (Serial1.available()) {
Serial1.write(Serial1.read());
digitalWrite(13, HIGH);
}
}