If I'm sending characters using SoftSerial, these are returned together with the response from the 'remote station'. I'm using a SIM900 module with Uno; however the SIM900 does not return the received characters if I'm contacting it with (hardware) Serial.
Is this normal? If yes, is there a way to prevent it? Any help welcome!
Example code:
#include <SoftwareSerial.h>
SoftwareSerial SIM900_Serial(7,8);
String fromSIM = "" ; // holds the string returned by the SIM900 module
void setup()
{
SIM900_Serial.begin(19200); // software serial to SIM900
Serial.begin(19200); // hardware serial ATmega to USB
delay(5000); // wait for the serial communication to establish
SIM900_Serial.println("AT+CMGF=1"); // send AT command to set SIM900 to text mode
delay(1000); // give the module some time to respond
while (SIM900_Serial.available() > 0)
{ char inChar = (char)SIM900_Serial.read();
fromSIM += inChar;
delay(10);
}
Serial.println(fromSIM); // prints "AT+CMGF=1 \n OK", but response from SIM900 is just "\n OK"
}
void loop()
{
}