It might help to log both the Command (as sent) and the response:
#include <SoftwareSerial.h>
const boolean 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);
// formerly in void getgps(void)
sendData( "AT+CGNSPWR=1", 1000, DEBUG);
sendData( "AT+CGNSSEQ=GGA", 1000, DEBUG);
}
void loop()
{
//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);
}
String sendData(String command, const int timeout, boolean debug)
{
String response = "";
if (debug) {
Serial.print(F("Command: \""));
Serial.print(command);
Serial.println("\"");
}
mySerial.println(command);
long int time = millis();
while (millis() - time < timeout)
{
while (mySerial.available())
{
char c = mySerial.read();
response += c;
}
}
if (debug)
{
Serial.print(F("Response: \""));
Serial.print(response);
Serial.println("\"");
}
return response;
}