I'm trying to send an array of 50 floats to my server via JSON post. It seems there is a limitation on the command length. In addition once the command is longer than ~270 chars then it will take more than 10sec to execute. If the lenght is over ~400 chars then it will just fail. This limitation is not present if I execute the same command via a SSH session (in this case the command executes instantly and I see the post on my server).
I created a simple test script to replicate the problem. This code execute a JSON POST with a progressively longer string. Each iteration adds ~30 chars .
Once you execute the code you'll see 3 medium-length LED flashes, followed by 3 long ones, and a series of rapid ones. Here the length of characters of the command and its execution time (LED-on time) for the first 8 iterations:
I did modify the two files and the results are strange. First time I executed it, it was correct for length <400 chars. Now, I'm back as the original problem. I double checked and both files still have the correct "python -u" modification. Any idea/suggestion? I tried to restart the Yun and/or upload a sketch, it just makes no difference.
Thanks,
PS: Why is the execution time is orders of magnitude higher than just running the same command via SSH even for length<300?
In addition with the code provided I found that the 10sec increased resolution is only for command length between 299 and 507 chars, the request is executed correctly if <299 or greater than 520 and less than 845. Anything longer than 845 will fail. This weird behavior is only with this code:
The maximum baudrate is 115200 baud. Tests with 230400 baud always failed on the first read attempt.
With the simple Arduino Sketch (see below) the IO-throughput is about 10kB/s.
Thank Sonnyyu, I don't think I got what you mean. I think this might relates to another topic. I'm trying to send data to my server on Amazon Cloud and it seems quite hard to do with the yun if I need to send relatively large amount of data (50 floats) every sec.
sonnyyu:
The maximum baudrate is 115200 baud. Tests with 230400 baud always failed on the first read attempt.
With the simple Arduino Sketch (see below) the IO-throughput is about 10kB/s.
ok, now I understand it what do you mean. I thought this has to be a bug since the yun should be able to support 200 bytes/sec (50 floats *4 byte every sec) without any problem. Do you think the problem is getting the data out of the arduino and into the linino part?
The goal is to get the data out of the yun via the wifi connection and it is requiring quite more effort than I thought. Do you think it'll be easier to just use a Uno with a wifi shield? I'm quite a newbie with the yun.
sonnyyu:
It means if speed/bandwidth is very important then do not use bridge ( disable it), use pure UART instead of.