I send the SMS "Hello World", but on my cellular I get this message ATAT+CMGS="xxxxxx">HelloWorld instead. What can be causing this?
void controlAT()
{
clearString();
wait_ms(100);
SIM900.printf("AT\r");
wait_ms(1000);
if(result=="\r\nOK\r\n") {
pc.printf("\r\n----OK AT----\r\n");
}else {
pc.printf("-- ERROR AT --");
}
pc.printf("%s",result.c_str());
}
/*send SMS */
void sendSMS_Raw()
{
clearString();
SIM900.printf("AT+CMGS=");
SIM900.printf("\"");
SIM900.printf("+xxxxxxxxxxxxx");
SIM900.printf("\"");
SIM900.printf("\r");
SIM900.printf("Hello World");
SIM900.printf("\r");
SIM900.putc(0x1A);
wait_ms(200);
pc.printf("%s",result.c_str());
clearString();
})
/**MAIN**/
int main() {
pc.printf("\r\n GSM 900 TEST\n");
SIM900.attach(&callback_rx);
SIM900.baud(9600);
wait_ms(100);
while(1) {
wait(1.0); // 1 sec
pc.printf("\r\n---MAIN---\n");
controlAT();
sendSMS_Raw();
pc.printf("\r\n---FINE---\n");
wait(2.0); // 1 sec
}
}