Hi, Guys!
I read in more forum themes, that MEGA 2560 microcontroller has 3 additional Serial Ports (RX1-TX1, RX2-TX2, RX3-TX3).
I've found a very good Serial Test from zoomkat, which uses "programmer" Serial Port (0-1).
// ***********************
String readString;
void setup() {
Serial.begin(9600);
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 = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
readString="";
}
}
This sketch is working very well, but I'd like to use in place of programmer serial port one of the additional serial ports: 1,2,3.
I modified a bit this sketch, like that:
// ***********************
String readString;
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
Serial.println("serial test 0021"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) // I LEFT Serial, NOT CHANGED TO SERIAL1 {
delay(2); //delay to allow byte to arrive in input buffer
char c = Serial1.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
readString="";
}
}
Nothing happened, the serial communication is dead... Please help me, WHAT did I do wrong?
Thanks: rcph