Hi,
thanks for taking the time to read my post. I am trying to send a long string command to my SIM900 through serial. i send the command, then it responds through serial confirming the command i just sent (echo). When i go to send my URL for it to connect to, which is the longest string of all i send it, it only echos back part of the command.
I'm not sure if the Arduino is not sending the full command or if i'm only reading part of the echo serial response. Here's the related bits of code to serial.
void printSerialData() { //read from the SIM Module
while(myGsm.available()) {
if (myGsm.available() >0) {
delay(100);
String c = myGsm.readString();
Serial.print(c);
}
}
}
void httpConnect() {
myGsm.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\""); // Set Connection to GPRS context
delay(1000);
Serial.println(" setting connection type");
printSerialData();
myGsm.println("AT+SAPBR=3,1,\"APN\",\"WWW.vodafone.net.nz\""); // Open a GPRS context
delay(3000);
printSerialData();
myGsm.println("AT+SAPBR=1,1"); // Open a GPRS context
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=2,1"); // To query the GPRS context, check connection status
delay(1000);
printSerialData();
myGsm.println("AT+HTTPINIT"); // Initialize HTTP
delay(5000);
printSerialData();
myGsm.println("AT+HTTPPARA=\"CID\",1"); // End the PARA
delay(5000);
printSerialData();
myGsm.print("AT+HTTPPARA=\"URL\",\"http://tries.hard.com/i.php?md=""moduleID""\""); // Send PARA command, set url to send data
delay(50);
// myGsm.print("moduleid=");
// myGsm.print(moduleID);
/* myGsm.print("&");
for(int i=0; i<16; i++) {
delay(1);
Serial.print(i); Serial.print(" ");
myGsm.print("sen"); myGsm.print(i+1); myGsm.print("=");
myGsm.print(dataArray[i],8);
myGsm.print("&");
delay(10);} */
delay(2000);
printSerialData();
myGsm.println(""); // close url
delay(5000);
printSerialData();
myGsm.println("AT+HTTPACTION=0");
delay(5000);
printSerialData();
delay(5000);
printSerialData();
delay(5000);
printSerialData();
myGsm.println("AT+HTTPREAD");
delay(5000);
printSerialData();
delay(5000);
printSerialData();
myGsm.println("AT+HTTPTERM");
delay(2000);
printSerialData();
}
And heres a screenshot of the response of the problem line
the url stops reading on the serial monitor just before the equals(=) sign and doesnt show the value of moduleID at all.
Hope this makes sense, i will respond to questions of anyone trying to help.