this is the code of arduino ide. i want to send value data latitude and longitude from gps modul to 000webhost server using sim900. but i always have error from the AT+CIPSEND.
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <String.h>
SoftwareSerial SIM900(7,8);
SoftwareSerial gpsSerial(4,3);
TinyGPSPlus gps; // The TinyGPS++ object
float latitude = 32;
float longitude = 32;
void setup()
{
Serial.begin(9600);
SIM900.begin(9600);
delay(100);
Serial.println("Initializing...");
delay(1000);
SIM900.println("AT");
updateSerial();
SIM900.println("AT+CPIN?");
updateSerial();
SIM900.println("AT+CREG?");
updateSerial();
SIM900.println("AT+COPS?");
updateSerial();
delay(1000);
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
SIM900.write(Serial.read());
}
while(SIM900.available())
{
Serial.write(SIM900.read());
}
}
void send_data()
{
Serial.begin(9600);
SIM900.begin(9600);
delay(100);
SIM900.println("AT+CGATT?");
updateSerial();
SIM900.println("AT+CIPSHUT");
updateSerial();
SIM900.println("AT+CIPSTATUS");
updateSerial();
SIM900.println("AT+CIPMUX=0");
updateSerial();
SIM900.println("AT+CGATT?");
updateSerial();
SIM900.println("AT+CSTT=\"airtelgprs.com\"");
updateSerial();
SIM900.println("AT+CIICR");
delay(2000);
updateSerial();
SIM900.println("AT+CIFSR");
updateSerial();
SIM900.println("AT+CIPSPRT=0");
delay(3000);
updateSerial();
SIM900.println("AT+CIPSTART=\"TCP\",\"xxxxx.000webhostapp.com\",\"80\"");
delay(3000);
updateSerial();
SIM900.println("AT+CIPSEND");
delay(15000);
updateSerial();
String str="GET /coba.php?latitude=" + String(latitude) + "&longitude=" +String(longitude);
Serial.println(str);
SIM900.println(str);
updateSerial();
SIM900.println((char)26);
delay(5000);
SIM900.println();
updateSerial();
SIM900.println("AT+CIPSHUT");
delay(100);
}
void loop()
{
Serial.println("daftar lokasi kendaraan");
lokasi();
send_data();
}
void lokasi()
{
Serial.begin(9600);
gpsSerial.begin(9600);
while(1)
{
while (gpsSerial.available() > 0)
{ gps.encode(gpsSerial.read()); }
if (gps.location.isUpdated())
{
latitude=gps.location.lat();
longitude=gps.location.lng();
break;
}
}
Serial.println("LATITUDE=" + String(latitude,6));
Serial.println("LONGITUDE=" + String(longitude,6));
delay(1000);
}
there is the error of my code. THE OTHERS AT COMMAND can response OK. Please help my problem
AT+CIPSEND
CLOSED
ERROR
GET /coba.php?latitude=-7.79&longitude=110.39
GET /coba.php?latitude=-7.79&longitude=110.39
SIM900 R11.0