I have to send data on server using SIM900A
but when I send data to server it just send BLANK DATA on server.
please suggest me what the mistake in code.
Thank you
Here Is my code:--------
#include<SoftwareSerial.h>
SoftwareSerial serial(2, 3);//rx, tx
void setup()
{
serial.begin(9600);
Serial.begin(9600); //Initialize a serial communication with baud rate 9600
//delay(500);
}
void loop()
{
UploadData(aurdino);
delay(1000);
}
//Data uploading
void UploadData(String i)
{
serial.println("AT+CGATT=1");
delay(1000);
toSerial();
delay(2000);
serial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
delay(1000);
toSerial();
delay(3000);
serial.println("AT+SAPBR=3,1,\"APN\",\"airtelgprs.com\"");
delay(1000);
toSerial();
delay(3000);
//Enable bearer 1
serial.println("AT+SAPBR=1,1");
delay(1000);
toSerial();
delay(3000);
//Check whether bearer 1 is open.
serial.println("AT+SAPBR=2,1");
delay(1000);
toSerial();
delay(1000);
//Initialize HTTP service
serial.println("AT+HTTPINIT");
delay(1000);
toSerial();
delay(3000);
//Set the context ID
serial.println("AT+HTTPPARA=\"CID\",1");
delay(1000);
toSerial();
delay(3000);
serial.println("AT+HTTPPARA=\"URL\",\"http://xxxxxxxxxxx/xxxxxx/insert.php?arduno=122");
//Set up the HTTP action
serial.println("AT+HTTPACTION=1");
delay(1000);
toSerial();
delay(6000);
//Do a HTTP read
serial.println("AT+HTTPREAD");
delay(1000);
toSerial();
delay(10000);
//Terminate the HTTP service
serial.println("AT+HTTPTERM");
delay(1000);
toSerial();
delay(3000);
}
void toSerial()
{
while(serial.available()>0)
{
Serial.write(serial.read());
}
delay(200);
}