Hi everyone! Thank you for your help!
I don't understand the function of "params" here
mySerial.println("params=" + data1 + "~" + data2);
It is sent to a SIM800L module as an AT command; but I can't find "params" in AT command manual; so probably it's something else.
Any help?
Here is the full sketch.
#include <SoftwareSerial.h>
#include <Wire.h>
SoftwareSerial mySerial(7, 8); // RX, TX Pins
String apn = "apn.fastweb.it"; //APN
String apn_u = ""; //APN-Username
String apn_p = ""; //APN-Password
String url = "http://www.google.com"; //URL for HTTP-POST-REQUEST
String data1; //String for the first Paramter (e.g. Sensor1)
String data2; //String for the second Paramter (e.g. Sensor2)
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
delay(5000);
data1 = "123";
data2 = "ABC";
gsm_sendhttp(); //Start the GSM-Modul and start the transmisson
delay(60000); //Wait one minute
}
void loop() { // run over and over
}
void gsm_sendhttp() {
Serial.println(">>AT");
mySerial.println("AT");
runsl();//Print GSM Status an the Serial Output;
Serial.println("");
delay(4000);
Serial.println(">>AT+SAPBR=3,1,Contype,GPRS");
mySerial.println("AT+SAPBR=3,1,Contype,GPRS");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+SAPBR=3,1,APN," + apn);
mySerial.println("AT+SAPBR=3,1,APN," + apn);
runsl();
Serial.println("");
delay(100);
//mySerial.println("AT+SAPBR=3,1,USER," + apn_u); //Comment out, if you need username
//runsl();
//delay(100);
//mySerial.println("AT+SAPBR=3,1,PWD," + apn_p); //Comment out, if you need password
//runsl();
delay(100);
Serial.println(">>AT+SAPBR =1,1");
mySerial.println("AT+SAPBR =1,1");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+SAPBR=2,1");
mySerial.println("AT+SAPBR=2,1");
runsl();
Serial.println("");
delay(2000);
Serial.println(">>AT+HTTPINIT");
mySerial.println("AT+HTTPINIT");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+HTTPPARA=CID,1");
mySerial.println("AT+HTTPPARA=CID,1");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+HTTPPARA=URL," + url);
mySerial.println("AT+HTTPPARA=URL," + url);
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded");
mySerial.println("AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+HTTPDATA=192,10000");
mySerial.println("AT+HTTPDATA=192,10000");
runsl();
Serial.println("");
delay(100);
Serial.println(">>params=" + data1 + "~" + data2);
mySerial.println("params=" + data1 + "~" + data2);
runsl();
Serial.println("");
delay(10000);
Serial.println(">>AT+HTTPACTION=1");
mySerial.println("AT+HTTPACTION=1");
runsl();
Serial.println("");
delay(5000);
Serial.println(">>AT+HTTPREAD");
mySerial.println("AT+HTTPREAD");
runsl();
Serial.println("");
delay(100);
Serial.println(">>AT+HTTPTERM");
mySerial.println("AT+HTTPTERM");
runsl();
Serial.println("");
Serial.println(">>AT");
mySerial.println("AT");
runsl();//Print GSM Status an the Serial Output;
Serial.println("");
Serial.println(">>AT");
mySerial.println("AT");
runsl();//Print GSM Status an the Serial Output;
Serial.println("");
}
//Print GSM Status
void runsl() {
delay(500);
while (mySerial.available()) {
Serial.write(mySerial.read());
}
}