Hi
I’m Trying to post data using my WIO LTE CAT1 EU to a database, but i’m struggling with this board. I plug in 4G SIMCARD, and try a lot of sketches of http post, but without suscess. With other boards like ESP32 or ESP8266 i can make it work, but not with this one. Could anyone share a sketch example that works with this board do post or get data data? Thanks
I think you have to perform this rask by using WioLTE, wire.h and arduinohttpclient.h
Hi. I write a sketch and can obtais response from server, however it do not post anything. What could be wrong?
char data[256];
int status;
SerialUSB.println("### Post.");
sprintf(data, "api_key=%s&sensor=%s&ambiente=%.2f&interior=%.2f&voltagem=%.2f&eragem=%.2f&potencia=%.2f", apiKeyValue.c_str(), sensor.c_str(), temp_ambiente, temp_interior, voltage, current, power);
SerialUSB.print("Post:");
SerialUSB.print(data);
SerialUSB.println("");
if (!Wio.HttpPost(URL, data, &status)) {
SerialUSB.println("### ERROR! HttpPost ###");
}
else
{
SerialUSB.print("Status: ");
SerialUSB.println(status);
}
The code below work on an esp32 withe httpclient.h library, that unfortunally is not compatible with Wio LTE
HTTPClient http;
// Your Domain name with URL path or IP address with path
http.begin(serverName);
// Specify content-type header
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
// Prepare your HTTP POST request data
String httpRequestData = "api_key=" + apiKeyValue + "&sensor=" + WiFi.macAddress()
+ "&location=" + "" + "&atual=" + temp_atual
+ "&minima=" + servidor_min + "&maxima=" + servidor_max + "";
Serial.print("httpRequestData: ");
Serial.println(httpRequestData);
// Send HTTP POST request
int httpResponseCode = http.POST(httpRequestData);
if (httpResponseCode>0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
// Free resources
http.end();
pedro_santos:
Hi
I’m Trying to post data using my WIO LTE CAT1 EU to a database, but i’m struggling with this board. I plug in 4G SIMCARD, and try a lot of sketches of http post, but without suscess. With other boards like ESP32 or ESP8266 i can make it work, but not with this one. Could anyone share a sketch example that works with this board do post or get data data? Thanks
Perhaps you can follow the steps in this Wiki to play WIO LTE CAT1 EU