I am using SIMCOM SIM900 module and Arduino uno. I am able to send Static data to the server using the AT+PARA command but am unable to do so when sending just the variable data. The variable is continuously storing data received from a sensor. Is it because the variable has continuous change in value?
Static format:
mySerial.println("AT+HTTPPARA=\"URL\",\"http://www.website.com/test.php?vehicleNo=7575\"");
with variable:
vehicleNo=function();
mySerial.println("AT+HTTPPARA=\"URL\",\"http://www.website.com/test.php?vehicleNo\"");
I am able to display the variable value on the serial monitor.
What might be the issue and what can be done to solve it?
Its not the right way to send variable values to database.
mySerial.println("AT+HTTPPARA=\"URL\",\"http://www.website.com/test.php?vehicleNo\"");
you expect that vehicleNo
in the above block of code would be replaced by its value when the link is executed by arduino, But it will not be. If you want to perform what you expected it more complex than you did.
at first define two array of type char say 'url' and 'val' as follows :
char url[160];
char val[10];
then it require some edit at the request part as :
dtostrf( vehicleNo,7, 2, val);
sprintf(url, "AT+HTTPPARA=\"URL\",\"http://www.3dedn.com/test.php?vehicleNo=%s\"",val );
Now your link is in array 'url' ,
mySerial.println(url);
This will do what you need.Good luck.