-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending data via HTTP #35
Comments
Maybe you can debug the printed information to make the problem more specific. I don't have the corresponding module at present. |
3 questions for you:
|
Hi Hoerup, Thanks you for effort. This is the code: #include <DFRobot_SIM808.h> char buffer[256]; void setup()
void loop()
} This is the output by serial monitor: --> Connect www.ikomoto.com OK Can you help me? |
Hi qsjhyy, The output is in the upper part. |
So you're using the hardware serial both for arduion<->SIM808 - and for debug output - that makes it a bit more difficult to interpret then Oh and you still have a double \r\n between the request line and first header - thats not correct ! |
I think the focus in on these lines, but I don't understand where is the problem:
|
Looking at the source: it looks like theres a bug in detachGPS? https://github.com/DFRobot/DFRobot_SIM808/blob/master/src/DFRobot_SIM808.cpp#L894 imho it should stop the GPS dataflow by sending "AT+CGNSTST=0\r\n" |
the latest output is this, but the coordinates into db isn't writted...... 11:55:11.685 -> --> Connect www.ikomoto.com OK 11:55:43.759 -> AT+CIPSTART="TCP","ikomoto.com",80 |
That sounds reasonable. You can verify it first and then add a line bool DFRobot_SIM808::detachGPS()
{
if(!sim808_check_with_cmd("AT+CGNSTST=0\r\n", "OK\r\n", CMD)) {
return false;
}
if(!sim808_check_with_cmd("AT+CGNSPWR=0\r\n", "OK\r\n", CMD)) {
return false;
}
return true;
} |
@antmariani if you apply ☝️ it will probably be easier to debug whats going wrong with the http communication |
sorry @hoerup what should i apply? i think we need to debug the http connection, it seems that arduino does not send the correct string to the db.. |
any suggestion for me ? |
@antmariani solution 1: solution 2: |
Hello guys,
I want to send my HTTP request to this API:
http://www.ikomoto.com/adiramef/api/generic.php?add_to_db&latitude=" + String(lati) + "&longitude=" + String(longi) + "&device_name=Frigorifero" + " HTTP/1.1\r\n\r\n " ;
and I modified my code as below. However, when I send my request through the browser URL, the server receives it successfully,
but the code doesn't send my request successfully. Can someone please put some lights on what I am doing wrong here? Thanks in advance!
#include <DFRobot_SIM808.h>
DFRobot_SIM808 sim808(&Serial);
char buffer[256];
float lati, longi;
void setup()
{
Serial.begin(9600);
void loop()
{
//************** Get GPS data *******************
float lati, longi;
if (sim808.getGPS()) {
Serial.println(" ");
Serial.print("Latitudine rilevata :");
Serial.println(sim808.GPSdata.lat,10);
Serial.print("Longitudine rilevata :");
Serial.println(sim808.GPSdata.lon,10);
Serial.println();
}
The text was updated successfully, but these errors were encountered: