[Solved] Arduino crashes with web input

Hi, I have a script that I have been hacking at, trying to figure out how stuff works and I have come up against a wall. The sketch compiles, uploads, and runs fine, but when I try and go to the webpage of the ethernet shield it crashes. I have the Arduino UNO, the official Ethernet Shield (ws5100). I am trying to use the web interface to turn on and off an LED. I also have a 16X2 LCD hooked up to show some statuses. This is the code that I have been working with. I found the original here: http://arduino.cc/forum/index.php/topic,54378.0.html

My code is over the limit to post in here and the upload folder said it was full, so I made a text file that can be found here, http://www.towerboy.com/code.txt

The code runs fine, as in, the number for reps is incremented and printed to the LCD every time but as soon a I try to load the webpage for the ethernet shield, the number freezes and won't start again without a reset. Is this something to do with running out of memory? What can I do as I am very new and haven't a clue? Thanks!

Jeremy

    reps = ++reps;    ///

reps is incremented by one, by the ++reps; statement. The result of this is uselessly then stored in reps. Why?

All of the arrays and constants, including constant strings are stored in SRAM. You have a very large number of strings, and are most likely running out of memory.

The only reason for the "reps" incrementing was so that I could "know" that the program was still running... Yes, I wanted the number to change, print the number to the screen, change the number, print the number... That is the only way that I could come up with quickly to test when the code stopped... I will look into SRAM stuff... Totally newb at this... Thanks.

Jeremy

Wait... You said that they are all stored in SRAM... Where should they be stored? Maybe I should make use of the SD Card slot on the Ethernet Shield?

Jeremy

reps++;

or

++reps;

is all that is needed to increment the value in reps. Assigning the newly incremented value to reps is equivalent to this:

++reps;
reps = reps;

You said that they are all stored in SRAM... Where should they be stored?

In SRAM. There are ways of storing the data in Flash, instead, using PROGMEM, but getting the data out is trickier.

The web page to be served up could be stored on an SD card, but that requires switching back and forth between the SD card being active and the ethernet shield being active.

Simplifying the web page you are serving seems like a better approach to me.

OK, I figured out how to simplify the html image refresh code and now it works great. Thanks for you help.

Jeremy