HELP!!! Sending message using AT Command

if(readString.indexOf("+639") >0){
      String number = readString.substring(7,20);
      delay(100);
      Serial1.print("AT + CMGS = \"" + number +"\""); 
      delay(100);
      Serial1.print("LED ON"); // SMS body
      delay(100);
      Serial1.println((char)26);
      delay(100);

This is the line of code I used to send an SMS to a certain number

The Serial Monitor outputs as follows

+CMT: "+639152636757","","16/01/23,22:32:38+32"
LED ON
AT + CMGS = "+639152636757"LED ON

ERROR
AT + CMGS = "GS = "+639152"LED ON

ERROR
AT + CMGS = "GS = "GS = "+"LED ON

ERROR

Was there a question in there somewhere?

It should be similar to this but you need to iron out the details:

     foo = AT + "CMGS = \"" + number +"\"";
      Serial1.print(foo);

The modem cannot speak C++.

--aarg

What do you mean sir with tha?

      Serial1.print("AT + CMGS = \"" + number +"\"");
  • is the addition operator. Grab your calculator and try to add those two strings. What do you get?

(It is NOT a concatenation operator)