Hello
I have written one new sketch from the scratch. It is working as expected. $GPGGA data is coming at serial monitor as expected.
The problem is when I send the data by using AT+CIPSEND, the result is coming "SEND OK". But at the Server window[I am using TC/IP server. GSM is client, and my Laptop is server] it is showing AT+CIPSEND=1, not the string "$GPGGA". Am I doing any mistakes?
Here is the below sketch.
#include <SoftwareSerial.h>
#include<stdio.h>
#include<string.h>
#define DEBUG true
#define RXPIN 5
#define TXPIN 4
SoftwareSerial mySerial(TXPIN , RXPIN); //4 is for TX and 3 is for RX
void setup() {
Serial.begin(4800);
mySerial.begin(4800); // connect gps sensor
sendData("AT+CIPSHUT\r\n",1000,DEBUG);
sendData("AT+CIPMUX=0\r\n",1000,DEBUG);
sendData("AT+CGATT=1\r\n",1000,DEBUG);
sendData("AT+CSTT=\"voda.com\",\"\",\"\"\r\n",1000,DEBUG);
sendData("AT+CIICR\r\n",2000,DEBUG);
sendData("AT+CIFSR\r\n",1000,DEBUG);
sendData("AT+CIPSTART=\"TCP\",\"xxx.xxx.xxx.3\",\"4001\"\r\n",1000,DEBUG);
}
void loop()
{
getgps();
while(1)
{
//sendData( "AT+CGPSOUT=2",1000,DEBUG);
String gpsoutput="AT+CGPSOUT=2";
String cipSend ="AT+CIPSEND=";
cipSend +=String(gpsoutput.length());
cipSend +="\r\n";
sendData(cipSend,500,DEBUG);
delay(2000);
//delay(3000);
}
}
void getgps(void)
{
sendData( "AT+CGNSPWR=1",1000,DEBUG);
sendData( "AT+CGNSSEQ=GGA",1000,DEBUG);
}
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
mySerial.println(command);
long int time = millis();
while( (time+timeout) > millis())
{
while(mySerial.available())
{
char c = mySerial.read();
response+=c;
}
}
if(debug)
{
Serial.print(response);
}
return response;
}
Please advice.