Sim900 at+cmgs invalid input value

Status
Not open for further replies.

Manoela Brum

Newbie level 2
Joined
May 6, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,348
Hi people!

I am writing a code that between other things send sms to a number registered and if I isolate the code of send, it works. But if I put the code within of the big code that have the others functions, the code of send dont work and response "invalid input value".

The code that works:

void setup(){
Serial.begin(19200);
SMS.begin(19200);



char n[12];

sprintf(n, "05484147924\0");

String numero, hello = "Hello!";

hello += "Good";
hello += "morning!";


Serial.println("Inicio");
SMS.println("AT+CMEE=2");
SMS.println("AT+CMGF=1\r"); // definindo modo texto para sms
delay(100);
SMS.print("AT+CMGS=\"");
delay(100);
SMS.print(numero); // numero definido para o modulo pc
delay(100);
SMS.println("\"");
delay(1000);
SMS.print(hello); // conteudo da mensagem
delay(100);
SMS.print((char)26); // ctrl z = finaliza a mensagem
delay(2000);
Serial.println("Fim");

}

The code that not works:

nremetente = string[3];
strcpy(ncad, nremetente); // ncad = nremetente;


void sendMessage(){
String bodySms, numero(ncad);

// dar um delay 10000 pra esperar receber todos os ok...
delay(20000);
SMS.println("AT+CMGF=1\r"); // definindo modo texto para sms
delay(100);
SMS.println("AT+CMEE=2");
delay(100);
SMS.flush();
delay(100);
SMS.print("AT+CMGS=\"");
delay(100);
SMS.print(numero); // numero definido para o modulo pc
delay(100);
SMS.println("\"");
delay(100);
SMS.print(bodySms); // conteudo da mensagem
delay(100);
SMS.print((char)26); // ctrl z = finaliza a mensagem
delay(5000);

}


Please I need help!

Thanks!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…