Arduino Forum

Products => Arduino Yún => Topic started by: VideoLiam on Sep 29, 2013, 10:11 pm

Title: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: VideoLiam on Sep 29, 2013, 10:11 pm
Hi,

I have been having a play with my Yun and seem to be having an issue with the HttpClient sketch which once running seems to crach after about 3 cycles (sometimes 4 or 5). Basically this seem to happen even when running on my laptop:- windoz7 and main system:Xp connecting to the Yun via USB and monitoring the Yun via the IDE serial monitor (and third party 'Clear terminal' port monitoring softwear).

I have not modified the sketch in any way. It runs, for about 3 cycles, pauses, and then prints the same rubbish, again and again.

Is there a server limit on the file http://arduino.cc/asciilogo.txt ? I'd hate to do a fault finding exercise only to find there is a limit..

I'm also having some problems with USB uploading and the board dropping in and out of the USB system, but I'm going to do more research before deciding that is a problem, but I'll mention it here incase this is relivent.

Oh, yes the Yun is linked to the PC via USB, but it is connected to the internet wireless.
Also a strange one, turn on PC, for 20min. Plug in YUN and leave for 20min (the sketch should be running). start IDE and open serial monitor, skech runs for about 5 cycles and crashes. Close serial monitor leave 10 min and reopen, jiberishs on the monitor repeated every 5 sec. reclose monitor and reopen... repeating jibberish...

Even more tests. I have tried using Cat5  connection only and disabled my wire router and it still crashes. Now its being an unreliable pain in the arse to reactivate the wi-fi.

Any thoughts...

Has anone else manange to let the sketch run for 5 min or more?

Thanks

Liam
Title: Re: HttpClient sketch, crashing after about three cycles.
Post by: federicofissore on Sep 30, 2013, 09:36 am
It seems like you're having the same issue as tragnutz
http://forum.arduino.cc/index.php?topic=188955.0

Can you do one of the following:
- replace your copy of Bridge.cpp (located at IDE_FOLDER/libraries/Bridge/src) and replace it with this one (https://raw.github.com/arduino/Arduino/ide-1.5.x/libraries/Bridge/src/Bridge.cpp)
- Download one of the nightly builds of the IDE from http://arduino.cc/en/Main/Software. These are built every day with the latest code available on github
Title: Re: HttpClient sketch, crashing after about three cycles.
Post by: VideoLiam on Oct 01, 2013, 12:31 am
Hi Federico,

Sorry it took so long to get back to you tonight, I had an Arduino robotics session at Google Campus London tonight, it felt really cool to be the only geek with a shiny new Yun... Got a few nods.... (Ok bragg over, back to play)

Right before I did any alterations I made sure the Yun was performing as expected, loading on the HttpClient sketch, watching it crash, and load up a blink test sketch to rest the Yun. Load up the HttpClient and watch it crash. All very much as expected and repeated it a few times to ensure things were repeatable...

Downloaded the bridge.ccp and inserted it into the scr directory for the bridge library, after renaming the old one' OLD_bridge.Xpp' for good measure. Resarted the IDE and loaded the HttpClient. Sat and watched for a moments or two.. and it just ran. went and got some biscuits and juice.. it was still running.... So I swapped back to the original Bridge.cpp file, cleared out the old HttpClient sketch with a blink sketch. restart the IDE and load up the HttpClient, and it crashed in the same old way... Swap back the new, restart the IDE and reload the HttpClient sketch, and its running away as I type this. So that must be 10min or so....I'm a slow typist and lousy speller.

That for me pretty much bags it as a defective bridge.cpp file.

Anyone else had the same results?

Liam
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Oct 01, 2013, 09:24 am
Unfortunately yes: http://forum.arduino.cc/index.php?topic=189834.0 http://forum.arduino.cc/index.php?topic=188955.0
We need to release an updated ide asap
Title: Re: HttpClient sketch, crashing after about three cycles.
Post by: AndersJJ on Oct 01, 2013, 09:47 am

It seems like you're having the same issue as tragnutz
http://forum.arduino.cc/index.php?topic=188955.0

Can you do one of the following:
- replace your copy of Bridge.cpp (located at IDE_FOLDER/libraries/Bridge/src) and replace it with this one (https://raw.github.com/arduino/Arduino/ide-1.5.x/libraries/Bridge/src/Bridge.cpp)
- Download one of the nightly builds of the IDE from http://arduino.cc/en/Main/Software. These are built every day with the latest code available on github


I have had the same issue, and tip #2 above does not fix it. Evidently #1 does, but I've not tried it yet.
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: VideoLiam on Oct 01, 2013, 09:54 am
Hi Federico,

I did read though the topic #188955, but they didn't seem to reply with any level of success, failure or even if they had given up. So my question was also to the bigger world who are reading in. Hopefully I have given you enough information to be of use. But clearly it is off assistance if others who might have had an issue tried this and found it was a fix as well. After all there could be a lot of people looking to use the Yun, So I guess all the feedback you can get helps :D

Liam
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Oct 01, 2013, 10:06 am
tragnutz said it worked, just as you did. http://forum.arduino.cc/index.php?topic=188955.msg1403190#msg1403190
I'm pretty sure the bug is fixed, at least with the amount of feedback we have received

Thank you very much for spotting, reporting and testing it :) That's exactly what we need to make it better and better :)
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: mundosimaginados on Oct 21, 2013, 12:20 am
Same problem with HttpClient sketch and solved with success with new Bridge.cpp.
It works ok for me.

Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 23, 2013, 07:58 am
Problem not solved:  I found the same issue with the old Bridge.cpp... It would cycle aprox 52 times before hanging on the client.get
I replaced the Bridge.cpp with the new version linked on this forum ... Now it works longer but hangs at aprox 132 cycles each time.

I sure hope this can get resolved ASAP!
This issue may make the board useless for my intended project but I have great hope that a solution is pending.

Update:
I have just tested several more times - the new Bridge.cpp will often go past the pervious 52 cycles... Howver I found now that it will hang on 28 and more or less just as before.
My test is running a cycle with a delay(10000) and fetching a one character page.
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Dec 23, 2013, 11:05 am
GinVan just to be sure, which version of the IDE are you using?
Can you post the sketch you're using?
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 25, 2013, 12:15 am
Code: [Select]
// This is a simplified version of the script (stripped of any string parsing, pointers or array issues)
// This program failed/hung a number of times (the last fail was at cycle 126)
// I am using the Bridge.cpp that was linked here in the forum
// Arduino IDE 1.5.5


#include <Bridge.h>
#include <HttpClient.h>

int count;
int command;
int duration;
int zero;
HttpClient client;

void setup() {
 Bridge.begin();
 Serial.begin(9600);
}

void loop() {

 Serial.print(count);
 Serial.print(" Fetching posts ");

 client.get("http://..../posts.php");

 Serial.println("| Posts received");

// NOTES:
// This script failed after 126 cycles - after printing the serial output above (fetch and receive)
// Other times it fails before the serial output "Posts received"
// To simply the script - I am not parsing strings
// I simply parseInt (below) - which works great (as long the programs gets to that point)
// The content on the posts.php is changed dynamically
// In this last fail - posts.php was left blank through the full 0 - 125 cycles
// The second call to client.get simply calls a php script to clear text files stored in posts.php
// My hosting provider will not render .txt files
// If two int are saved on the posts.php the program will retreive both in the variables below, followed by a trailing nill (0)

 while (client.available()) {

   command = client.parseInt();
   duration = client.parseInt();
   zero = client.parseInt();

   Serial.println(command);
   Serial.println(duration);

 }

 Serial.flush();
 client.get("http://..../clearposts.php");
 count++;
 delay(10000);

}
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: PCWorxLA on Dec 25, 2013, 12:39 am

// This is a simplified version of the script (stripped of any string parsing, pointers or array issues)
// This program failed/hung a number of times (the last fail was at cycle 126)
// I am using the Bridge.cpp that was linked here in the forum
// Arduino IDE 1.5.5
Considering that the 1.5.5 IDE was just released in early December (release notes from Nov.28), I am not sure if it is a good idea to replace the bridge.cpp file with one from a post in October or even earlier...

Ralf
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 25, 2013, 03:12 am
hmmm I don't know what to say... this time it ran for 995 cycles - still going.
I am not sure if there was a long delay on any of the cycles... I did not sit to watch.
Perhaps that could be the issue?  I should have put a timer on the reads...
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 25, 2013, 04:33 am
This is the fuller code to respond to page content and flash the led ... it stalled at 31 cycles ... and has not resumed after waiting 30 minutes.
I am new to programming in C ... is there any issues that would cause my code to fail randomly...?
The code ran for 18 cycles receiving blank content (as I was not yet updating the page with content) then stalled 14 cycles after receiving actual content of two integer numbers  (plus the trailimg null/0).

Code: [Select]
#include <Bridge.h>
#include <HttpClient.h>

int count;
int command;
int duration;
int zero;
HttpClient client;

void setup() {
 pinMode(13, OUTPUT);
 digitalWrite(13, LOW);
 Bridge.begin();
 Serial.begin(9600);


}
void loop() {
 Serial.print(count);
 Serial.print(" Fetching posts ");

 client.get("http://....../posts.php");
 Serial.println("| Posts received");

 while (client.available()) {
   command = client.parseInt();
   duration = client.parseInt();
   zero = client.parseInt();

   Serial.println(command);
   Serial.println(duration);

   checkcommand(command);

 }
 Serial.flush();
 client.get("http://....../clearposts.php");
 count++;
 delay(10000);
}


int checkcommand(int rc) {
 switch (rc) {
   case 0:
     break;
   case 1:
     break;
   case 2:
     break;
   case 3:
     flash(duration);
     break;
   case 4:
     break;
   case 5:
     break;
     return rc;
 }

}


int flash(int x) {

 Serial.print("Flash LED - number of times: ");
 Serial.println(x);
 for (int lp = 0; lp < x; lp++) {
   Serial.println(lp);
   digitalWrite(13, HIGH);
   delay(300);
   digitalWrite(13, LOW);
   delay(300);

 }
 return x;
}
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 25, 2013, 05:55 am
Quote
Considering that the 1.5.5 IDE was just released in early December (release notes from Nov.28), I am not sure if it is a good idea to replace the bridge.cpp file with one from a post in October or even earlier...


Good point Ralf... first day on the forum and in such a hopeful rush to solve the problem I was not observing dates.  Just now I downloaded the NIGHTLY ... which I am guessing contains both the latest IDE and Bridge.cpp

The yun stalled again at 39 cycles of the above code.
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: PCWorxLA on Dec 27, 2013, 02:22 am
Quote
Considering that the 1.5.5 IDE was just released in early December (release notes from Nov.28), I am not sure if it is a good idea to replace the bridge.cpp file with one from a post in October or even earlier...


Good point Ralf... first day on the forum and in such a hopeful rush to solve the problem I was not observing dates.  Just now I downloaded the NIGHTLY ... which I am guessing contains both the latest IDE and Bridge.cpp

The yun stalled again at 39 cycles of the above code.
I will have access to my Yun system again this weekend, I will give it a try and see what happens to me...

As for posting code, it would be a good idea if you get used to surrounding it by code "(#") tags, that makes it easier to read and to copy...  ;)

Ralf
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 28, 2013, 12:04 am
Quote
As for posting code, it would be a good idea if you get used to surrounding it by code "(#") tags, that makes it easier to read and to copy...  


Thanks Ralf for the tip... I edited my posts with code tags. (Good features on this forum - lots of helpful systems to learn about).

Also... In my eagerness (and apparent frustration - and lack of sleep while trying to resolve the http client issue :) )  I posted a rather wordy response on another thread that seemed to be related.  The changes to the files mentioned as a solution there (though I am not 100% clear if they are actually specifically related to this issue) did not solve the http client issue:

http://forum.arduino.cc/index.php?topic=196091

Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Dec 28, 2013, 01:32 pm
Yes, the nightly contains all the fixes available for the IDE. However, and just for the record, it does not fix or update your yun.

Your sketch seems right to me.
When you say "crashes" or "hangs", what are you experiencing exactly? What do you expect and what does not happen?
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 28, 2013, 11:29 pm
Hi Frederico... thanks for the reply and for also trying to help.
In my previous posts I provided two code examples.  The first version has more comments in the code with details regarding how the code seems to hang.
My code is printing serial output: a count, a marker before client.get and a marker "Fetching posts" showing that the code is has moved past the client get "Posts received".  I am updating page "posts.php" with content dynamically - either with blank content or two integers separated by a space such as "1 20" (1[space]20).  I have noticed that a trailing zero "0" is also received which I assume is the end of file marker "null".
I am running the code with a delay(10000) between client.get fetches.

The serial monitor displays output such as:
69 Fetching posts | Posts received
70 Fetching posts | Posts received  
71 Fetching posts

The display after a number of cycles will not move past "Fetching posts" such as the example above stalled at 71.

I am expecting the code to run continuously without fail so that I can receive and parse content when it is provided.

Code: [Select]
Serial.print(count);
Serial.print(" Fetching posts ");
client.get("http://..../posts.php");
Serial.println("| Posts received");



Also is there something I need to do to update code within my yun?  I edited some files that you mentioned on a previous thread.  There is a link above in my previous post.  Please advise me on how I can get this yun to operate... receiving content from the web continuously, without fail.

Thanks,

G

Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: VideoLiam on Dec 29, 2013, 11:17 am
Hi GinVan,

I was reading through your posts and just thought of one experiment that might be worth trying.

Have you tried to run your Yun on a different network?

Internal switches have been known to be poor quality, and if you are going via your service providers internet you have no idea what they are using.. Poor switchers can cause all sorts of problems. It is rare, but could be a simple experiment to try just to be sure.

Liam
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Dec 29, 2013, 09:43 pm
Hi Liam... I would also be curious about the response on another network, and perhaps another host, as well, however, I do not have those options immediately available.  Yet that would seem to me, at this time, to not be the true issue or solution anyway.  It would seem to me (though I am not an expert in the field) that the hypertext transfer protocol overcomes various issues that are anticipated in the transfer of data.   Surely a device such as the yun, that implements it, should run continuously and not hang 26 to 126 cycles into the loop.  When it does hang I have confirmd that the host (and ISP)  are still able to send/receive by refreshing another browser.
If Internet Explorer and Chrome are able to continuously access without fail (perhaps even running under a script that accomplishes the same purpose) than the issues is not with the ISP or host but with the mechanisms of the yun.
Also... It appears, in this thread (and others), that I am not the only one experiencing this problem with the yun.  

Further to those points I have these considerations that I will be looking for solutions for:
Lets say that the yun is running applications we consider to be important (maybe not a life sustaining human medical device :) ) but lets use an example we have seen before - feeding your pet or watering your plants, or...( let your creative imaginations take over)...
What if the yun crashes, what if the ISP or Host goes down for an hour?  Is there software/hardware solutions within the yun that we can implement to recover?  Is restart reliable enough?

The goal, again: host and ISP reliability assumed, is to use the yun to receive content reliably and indefinitely.

The other important question - what if we transfer the yun, running it's application, to another network that we as developers do not have access to... And without giving the end user access to the yun's control panel, how could a simple network/user/password interface be implemented to allow the user to connect to their own network?

G
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Dec 31, 2013, 11:50 am
Wow lots of input, I'll try to give answers...
Regarding:
- other users having similar problems: the biggest issue with the yun is that most of its power comes from the easiness in accessing a network, but unfortunately lots of things can break during a network transmission. I believe most of the problems arose so far are network related corner cases, hence they are hard to debug. I had no way to reproduce most of them (and the other became issues and some already got fixed)

- what happens if your ISP fails: it happens just what happens with your pc, you start saying "google is not working, the internet is broken!" :) Restarting the yun, in this case, is not a solution as it's not a solution with your pc

- how to give our configured/flashed yun to someone else, installing it on a different network. The simplest solution is you configuring it or you giving instructions for configuring it through the webpanel. You can develop your own webpanel, or provide an interactive sketch to configure network, but it's more work.

- finally your 71-then-hanged issue: as said many things can break during a network connection. I would try to debug the "finger pointing" way.

Let's point the finger to your sketch: does running the HttpClient example show the same behaviour? Maybe you want to modify it slightly so that it prints a counter as well.
Let's point a finger to yun's wifi: can you reset wifi conf (so that is restarts in access point mode), plug in an ethernet cable and rerun either your sketch or the HttpClient example?
Let's point a finger to the bridge: can you try running the following shell script from yun linux prompt?
Code: [Select]

# with these number this will run for about 27 hours
for n in `seq 1 10000`
do
curl http://arduino.cc/asciilogo.txt
sleep 10
done

Let's point a finger to your network as VideoLiam suggested: can you connect to another network and retry? (maybe you're at home, then connecting it to your office or school or friend's network will do)

I have no other targets for my finger right now. Let's see what comes out of these tests.
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: gkzsolt on Dec 31, 2013, 04:58 pm
Ginvan,

I run about your post today and beeing impressed about how long it has been discussed I made some experiments myself. First I reproduced the "gibberish in HttpClient sketch after 4-5 times" (I have IDE v. 1.5.4 installed, with the buggy Bridge). Then I applied the patch given by Federico in some earlier post ("avr: Fixed timeout in Bridge::transfer()" in https://github.com/arduino/Arduino/commit/ca90bf75cb1e256f728e879dc83d17bf3e02197b) (so I opened Bridge.cpp and modified 5 to 10 in the 2 lines given), because I have more confidence in this than to replace the file (which have been worked as well, I guess). AFter this I restarted the HttpClient sketch, which works for ~2 hours now without problems. If one cycle takes 7 seconds (5 + the time to get the request), it is about 9/min, so it run for at least 1000 times without problem.

So I would look after the network stability in your case, the Arduino seems to work and it is reliable enough for me.

Cheers,
   Zsolt
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: msssltd on Jan 02, 2014, 12:04 pm

It would seem to me (though I am not an expert in the field) that the hypertext transfer protocol overcomes various issues that are anticipated in the transfer of data.


Hello GinVan
I would describe myself as a network engineer who sometimes plays with software development.  I see things from a different perspective to software developers who sometimes play with networks.

Your assumption, that HTTP overcomes transmission issues, is quite wrong.  HTTP is an application protocol (layer 7).  Application protocols depend on the protocol stack beneath, (layers 1 to 6) and presume they are functioning correctly.  For instance, a broken cable (layer 1) will break HTTP, and every other protocol above Layer 1.  A poorly configured subnet (layer 3) will break HTTP, and every other application layer protocol.

Quote
Surely a device such as the yun, that implements it, should run continuously and not hang 26 to 126 cycles into the loop.  When it does hang I have confirmd that the host (and ISP)  are still able to send/receive by refreshing another browser.


Software developers new to network programming, have a habit of neglecting the dynamic nature of networks.  The things they tend to forget are;
+ Network access has a cost, measured in CPU and RAM.
+ What asynchronous means.
+ Transient fault conditions are a constant.
+ A protocol defines the means of cooperation but does not provide a method of implementation.
+ One observable symptom may describe many different fault conditions.

Put together, these attributes present your application with a number of failure modes (edge cases) which will cause an application to fail eventually, unless the application provides the functionality to handle  each failure mode gracefully.

Quote
If Internet Explorer and Chrome are able to continuously access without fail (perhaps even running under a script that accomplishes the same purpose) than the issues is not with the ISP or host but with the mechanisms of the yun.


No. No and again no.  The developers of Explorer and Chrome are experienced network programmers.  They have learnt the lessons I mentioned and have adapted their code to handle the edge cases gracefully.

Quote
Also... It appears, in this thread (and others), that I am not the only one experiencing this problem with the yun.


Statements like that cause me a great deal of frustration in my day job ;)  One observable symptom may describe many different fault conditions.  You are observing your problems.  Other people are observing other problems.  They may or may not be the same problems.  Try to focus on your own problems and no one else's.  

I have commented your code to highlight the things I would do differently.  I do not know whether these are your problems, only that such coding techniques are often problematic in network environments.

Code: [Select]

void loop(void)  {
 httpClient client;
 client.get("http://..../posts.php")  // a blocking call with an external dependancy
 
 while(client.available()) {
    //while the input buffer contains some_number of bytes
    command = client.parseInt();
   duration = client.parseInt();
   zero = client.parseInt();
  //read a finite number of bytes (6) from the buffer
 }
 client.get("http://.../clearposts.php");  //another blocking call
 delay(10000);  //another blocking call.
}


Here is a more graceful version of your while loop.
Code: [Select]

uint16_t bytesAvailable = client.available();
if (! (bytesAvailable < 6) ) {
 for (uint16_t i = 0; i < 6; i++) {
   command = client.parseInt();
   duration = client.parseInt();
   zero = client.parseInt();
 }
}


You should be able to remove the blocking behaviour of the .get(url) method by using the httpClient.getAsynchronously(url) method, although it appears the documentation has a glaring typo.
http://arduino.cc/en/Reference/YunHttpClientGetAsynchronously

The blocking caused by the delay(10000) can be avoided using a global variable and millis()
Code: [Select]

uint32_t periodStart = 0;
void loop(void) {
 uint32_t period = millis() - periodStart;
 if (period > 10000) {
   //do stuff
 }
}


Quote
Is there software/hardware solutions within the yun that we can implement to recover?  Is restart reliable enough?


I started out using the WiFi shield and can tell you for certain, that device will not provide reliable TCP performance unless the firmware is re-written.  The Yun is a leading edge device, providing a great deal of potential but it is early days.  The possibilities and the edge cases, are still being identified.

Quote
The goal, again: host and ISP reliability assumed, is to use the yun to receive content reliably and indefinitely.


Reliable is achievable.  Indefinitely is not achievable.  I have (proper) servers in the wild with uptimes measured in years but they will eventually need to be rebooted.  The applications being served, rarely make it past a month or so without a restart being required.

Quote
And without giving the end user access to the yun's control panel, how could a simple network/user/password interface be implemented to allow the user to connect to their own network?


As I often have to explain to my customers, inserting words like 'just' or 'simple' into a sentence, does not change the complexity of what the sentence describes.  Until such time IPV6 becomes ubiquitous, we are stuck having to write our own IPV4 subnet provisioning scripts.  Without remote access, we are stuck with the old fashioned support methods; documentation no one wants to read and trying to decipher the words, it does not work.

Best of luck and I hope the practical suggestions prove useful.

Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: federicofissore on Jan 04, 2014, 09:35 am

Here is a more graceful version of your while loop.
Code: [Select]

uint16_t bytesAvailable = client.available();
if (! (bytesAvailable < 6) ) {
 for (uint16_t i = 0; i < 6; i++) {
   command = client.parseInt();
   duration = client.parseInt();
   zero = client.parseInt();
 }
}



Thank you Matt, I'll share this piece of wisdom in future posts

Quote

As I often have to explain to my customers, inserting words like 'just' or 'simple' into a sentence, does not change the complexity of what the sentence describes.


Again thank you: I foresee many chances of using this phrase.
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Jan 06, 2014, 02:33 am
Thanks to each of you who has provided input.
The new network did not prove to work any better.
I will be testing the other suggestions and code provided and then comment asap.

Thanks,

G
Title: Re: HttpClient sketch, crashing after about three cycles. <possible solution>
Post by: GinVan on Jan 06, 2014, 07:19 am
While using the code sample from MattS-UK... I get this error in the arduino IDE:

Quote
Exception in thread "EventThread COM11" java.lang.NullPointerException
   at processing.app.Serial.serialEvent(Serial.java:176)
   at jssc.SerialPort$EventThread.run(SerialPort.java:1096)


The code I was testing ran longer than other codes... this failing at 197 cycles:

Code: [Select]
uint16_t bytesAvailable = client.available();
if (! (bytesAvailable < 6) ) {
  for (uint16_t i = 0; i < 6; i++) {
    command = client.parseInt();
    duration = client.parseInt();
    zero = client.parseInt();
  }
}