Hi good day/
I'm trying to talk to the SIM800L modem thru Serial3 on my ATMEGA2560 board. The problem is that the commands sent to the modem are also sent to the Serial monitor. How is that possible? I've checked every bit of the code and wiring. These maybe is not really a big problem, but it's unwanted messages on the serial monitor.
thanks....
Here's the code:
unsigned long tout;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial3.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//Serial.println("from serial");
Serial3.print("from serial3\r\n");
delay(1000);
Serial.print("from serial\r\n");
delay (1000);
sendCommand("AT",3000, true);
}
String sendCommand(String command , unsigned long timeout, bool debug){
String resp = "";
Serial3.println(command);
unsigned long time = millis();
while( (time + timeout) > millis()){
while( Serial3.available()){
char c= Serial3.read();
resp += c;
}
}
if(debug){
Serial.print(resp);
}
return resp;
}
Here the output from serial monitor: