The ethernet functions stop working after a few hours, but the other parts of the Arduino (button presses, LED, etc) work fine. Any ideas? I have to reset it for it to work properly again.
I haven't played with the ethershield yet, but I'm wanting to. That said, I didn't look through your code too well, but could it be a millis() overflow problem? The problem you describe fits the primary symptom...
I haven't heard of that problem before, but the other bits seem to work fine. Do you have a link?
Sure... I only have one project so far where I had to worry about this, but at first it caused for very weird behaviour a few days in :) If I recall my reading correctly, millis() was changed somewhere around arduino 10 or 11 to rollover from 9 hours to more like 50 days.
The first post I found that I seem to recall that clued me in was here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1200662708
It's a good read, whether that's the problem or not. Just make sure you're handling rollover correctly and beyond that I'm no help.
PS - Which shield setup are you using? I ran across this a while back and think I may try it out, but it's not the standard one people use (but its cheap): http://www.seeedstudio.com/depot/ethernet-adapter-for-mcu-projects-p-160.html
I'm using the regular Ethernet Shield, I bought it from here: http://store.fungizmos.com/index.php?main_page=product_info&cPath=65&products_id=229
The 9 hours sounds plausible, I don't notice it isn't working until the next day typically. I'll try modifying my code, it stinks that I have to wait 9 hours to see if it worked though!
I wanted to add that this did not seem to fix the problem. It took me awhile to get around to buying a new ethernet shield, I used the WIZnet 812MJ with the adafruit ethernet shield kit. It worked for about 8 hours, and then it stopped. I don't know how long exactly, but I do see that I can still ping the device, so its strange that it stopped hitting that web page whenever someone opens a door!
I don’t think it’s a millis() rollover problem, something to check is make sure all your buffer strings are long enough… those will cause certain things to stop once their full.
Just add another like 2 or 3 to your buffer arrays and you should be good to go.
All my code does is open a connection, it doesn't have to read anything! I can open and close as many doors as I want before the 8 hour window is up, but after that it won't send any emails. The strange thing is, it seems to work fine otherwise (makes beep sound when I open door, LED blinks, I can ping arduino). All the arduino needs to do it hit http://192.168.1.100/arduino.pl?alarm=5 where 5 is simply the pin it detected opening.
I put in a few "fixes" to see if that does anything. I made sure to use a client.stop command this time.
Interesting, I haven't played with an ethernet shield yet :/
But maybe it's something in your code that's not related to millis or your buffers? Hard to say, you should post your full code so hopefully some of the more experienced users can debug it.
Another thing to look out for, is your variables, make sure they don't get out of their range.
I did post my code in that other forum, let me post the latest copy here (with my temp fixes in it). Give me 24h
So the problem is that the arduino stops hitting that URL after about 8hrs. Here is the code: http://www.russelldraper.com/possibly_broken_ghetto_arduino.txt
The code was quick 'n' dirty, but I don't see anything obviously wrong with it. I just downloaded 0017 and recompiled/uploaded it to the arduino with that. Maybe that will make a difference.
So far, so good! It’s been over 18hrs, and its still working. Perhaps the 0017 IDE change fixed it, or maybe I needed a client.stop instruction in there after all. I’ll post again here if it stops working again.