Hello,
First of all, Im really liking the ubidots platform and interface!
Im using an Arduino Mega 2560 whit a Arduino GSM shield V2
I have a school project where im working on a telemetry system.
Now ive sucseeded in sending 5 values.
However when I add a 6 value the whole code stops working.
its has probely something to do whit sending the data in a inefficent way, insted of making one request im making 5 individual (See below for post commands).
Also the code stops after a while then it says in the debug monitor: ‘‘Connection failed’’ (then I have to restart the arduino).
This has probely somting to do whit maken too many requests.
Now I want to make a http post string (with 6 up to 20 varibles im trying to make a http post ‘‘payload’’ according to this example: https://gist.github.com/mariacarlinahernandez/6ec0da04dea7f436e63aa5dc67e6496a.
I needed to modify the code quite a bit to get a response from the server. and i still cant send 2 values to ubidots.
Im getting this response: {“detail”: “JSON parse error - No JSON object could be decoded”}.
I cant use the commands like client.add and client.sendall because thats int the ethernet libary and im using the GSM (those commands would make it so mutch easier).
I cant use the curl function either because the arduino IDE does not support the command.
Can you provide me whit a example/solution thats expandable that will work in the Arduino IDE?
Kind regards,
Robert
PS. this is the post part for 5 varibles:
client.print(“POST /api/v1.6/variables/” + VoltageWebID + "/values HTTP/1.1\nContent-Type: application/json\nContent-Length: " + String(VoltageLenght) + "\nX-Auth-Token: " + WebToken + “\nHost: things.ubidots.com\n\n”);
client.println(VoltageString);
client.print(“POST /api/v1.6/variables/” + CurrentWebID + "/values HTTP/1.1\nContent-Type: application/json\nContent-Length: " + String(CurrentLenght) + "\nX-Auth-Token: " + WebToken + “\nHost: things.ubidots.com\n\n”);
client.println(CurrentString);
client.print(“POST /api/v1.6/variables/” + CurrentDischargeWebID + "/values HTTP/1.1\nContent-Type: application/json\nContent-Length: " + String(CurrentDischargeLenght) + "\nX-Auth-Token: " + WebToken + “\nHost: things.ubidots.com\n\n”);
client.println(CurrentDischargeString);
client.print(“POST /api/v1.6/variables/” + CurrentChargeWebID + "/values HTTP/1.1\nContent-Type: application/json\nContent-Length: " + String(CurrentChargeLenght) + "\nX-Auth-Token: " + WebToken + “\nHost: things.ubidots.com\n\n”);
client.println(CurrentChargeString);
client.print(“POST /api/v1.6/variables/” + StateOfChargeWebID + "/values HTTP/1.1\nContent-Type: application/json\nContent-Length: " + String(StateOfChargeLenght) + "\nX-Auth-Token: " + WebToken + “\nHost: things.ubidots.com\n\n”);
client.println(StateOfChargeString);