-->
Page 1 of 1

Problem Parsing String to Sim800l.sendSms(celular),(message)

PostPosted: Mon Sep 19, 2016 6:11 am
by IOT_VENEZUELA
Hello ESP8266 Team .
Wishing all the best To all Of you .
Please forgive my english i am still learning .

escenario explanation to go straight to reach the topic point :

1)Variable String MESSAGE ,is an array build from a fixed header received by wifi webserver
2)variable String CELULAR gets the number to send sms to: , from String celular = (server.arg(2));

Very good i have 2 string variables CELULAR & MESSAGE .

3) the function Sim800l.sendSms('+1xxxxxxxx'),('hello world '); WORKS FINE HAND WRITING THE VALUES

4) what i need to solve on this topic is to be able to REPLACE THE VALUES HANDWRITTEN WITH THE VARIABLES
on the function Sim800l.sendSms(celular),(message); (without the errors no matching function for call to 'Sim800l::sendSms(String, String)')

Example of Data on the array build On String MESSAGE variable:
name=jhon smith
email=jhon@smith.com always fixed (server.arg(2));
cellular=+113456789
description = hi please help me out solve this topic so i can go ahead with my project

On next resume parts of the code , i have Comment sending message using AT commands using the variables CELULAR & MESSAGE that works GREAT , but i will prefer to use instead , the Sim800l.sendSms(celular),(message); so i can reduce the code size, processing time and use of resources on my ESP8266 .

Code: Select all

Libraries   included  <Sim800l.h> <ESP8266WiFi.h><WiFiClient.h><ESP8266WebServer.h><ESP8266mDNS.h><SoftwareSerial.h>


bool error; //to catch the response of sendSms

    String message = "Sending SMS \n\n";
      ///// reads the header received from webserver//////

    for (uint8_t i = 0; i < server.args(); i++) {             
 
  ///// build a string array with all variables received from header /////
 message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; 
  }
 
  server.send(200, "text/plain", message);  ///// sends all content of MESSAGE array to client in response//////

  String celular = (server.arg(2));   ///// stores the 2nd argument of the array (that will always be fixed celular number to be send the sms /////

 
   /////////// SENDING METHOD USING AT COMMANDS , WORKS FINE SENDS SMS OK  JUST AS REFERENCE !!!   //////   

                     /*        /////// // SENDS  AT COMMANDS TO sim800l  //////////////////////////
                                ///Serial.println("Sending SMS...al " + celular);
                                 //Set SMS format to ASCII
                               serialSIM800.write("AT+CMGF=1\r\n");
                                  serialSIM800.write("AT+CSCS=\"GSM\"\r\n");
                                    delay(1500);
                                   serialSIM800.print("AT+CMGS=\"");
                                   delay(25);
                                   serialSIM800.print(celular);
                                   serialSIM800.println("\"");
                                    delay(25);
                                   serialSIM800.println(message);
                                    delay(150);
                                     serialSIM800.write((char)26);
                                                                               */



error = Sim800l.sendSms(celular),(message);    ///compile error no matching function for call to Sim800l::sendSms(String&)'
 
error = Sim800l.sendSms((server.arg(2)),(message);  /// compile error no matching function for call to 'Sim800l::sendSms(String, String)'
 
 
 
 
  ///// error = Sim800l.sendSms('+1xxxxxxxx'),('i need this to be a variable ');   With handwriting  it works great sending the sms
  Serial.println("SMS Sent!to");
  Serial.println(celular);
  Serial.println(error);
 
  void loop(void) {
  server.handleClient();
}
 
   


If someone has the correct solutions for converting the variables in to a manner that i can place them inside the function Sim800l.sendSms(celular),(message); Please Just show me the conversion code needed to reach the goal , and i will logically understand the why .

I read 20 tutorials a day , and spend 12 hours reading daily , so please don't punish me sending me to read , cause i already read more than i can handle.

Thanks in advance for any help .