YUN: Executing Curl via Bridge: different behaviors based in length of commands
I got some strange behavior out of executing curl commands via Arduino to send data via json. In particular if the total command length is less than 300 or greater than 500 and less than 800 the program executes correctly. If the command is more than 800 it fails, if it is between 300 and 500 it takes more than 10 sec to execute (see table below)
I simplified the code and it seems length of command is part of the problem. I tried to follow the forum suggestion and added the '-u' to the python call but it didn't affect the problem.
Here's the link to the forum post and I hope this is a better place to report what I think is a bug: http://forum.arduino.cc/index.php?topic=222569.msg1626070#msg1626070
First column is the command length, second is execution time in ms, last column is amount of free memory in bytes. I only display the transition points, if you want the whole table just run the code below.
...
286 749 1605
299 10497 1592
...
507 10900 1384
520 866 1371
...
832 760 1059
845 143 1046
...
This is the example code to generate the above data:
# include <Bridge.h>
# include <HttpClient.h>
# include <MemoryFree.h>
String o;
HttpClient client;
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
Serial.begin(9600);
while(!Serial);
Serial.println("Starting...");
o="http://echo.jsontest.com/u?u=1234567890";
}
void loop() {
o+="&u=1234567890";
long now=millis();
client.get(o);
long del=millis()-now;
Serial.print(o.length());
Serial.print("\t");
Serial.print(String(del));
Serial.print("\t");
Serial.println(freeMemory());
}
Why did you close this? Have you solved it?
Ah sorry, duplicate