Hello everybody,
I'm french and I come to you because I deployed a network of xbee ( Api) with sensors of temperature LM35DZ. Indeed, I use the analogical input of xbees to get back the various temperatures. Every room contains a xbee, in receiver I have another xbee which gets back all the packages of transmitters. To see the temperatures, I use an arduino + ethernet shield to convert its packages in decimal values and send it on a HTML page. The acquisition matches a small moment then at the end of a few days the HTML page does not generate any more (it stays in perpetual research). This stop is never at the same moment. It is variable
I modified my code in order to put the reset as soon as the system doesn't respond but unfortunetly it is not sufficient... I don't know where is the problem now. Maybe the reset code is badly programmed?
It is probably in the Ethernet library. I don't know...
Upgrade to version 1.0.1 of the IDE. Version 1.0 had some problems with the Ethernet code that should be fixed in the new version. Compile your project with the new IDE and tell us if your freezes occur again. I guess you won't need your reset connection.
If you still have problems with freezing sketches, take a look at the watchdog features of the ATmega328:
Which, depending on your operating system, may contain a nasty bug that SurferTim documented and submitted a fix for. The fix IS part of the newer 1.0.1 version. I'd suggest that you upgrade.
This is not a reset, your just jumping to the bootloader code. For the ATmega328 this is similar to have got reset but all the other components don't get noticed and won't reset.
OK Ok it is not a watchdog, I just have to use the library <avr/wdt.h> and the command wdt_enable(WDTO_2S) for example. I hope that I would not use this command.
Upgrading IDE of arduino is not sufficient, my system stopped...I don't understand...
I try to put the watchdog in my code in order to see if it solves my problem...
No, I meant something different. If you connect a PC to your Arduino (if they have XBees you probably have to use SoftwareSerial and a USB2Serial adapter) and insert debugging statements into your code that put some string to the soft serial after every bit of code. On the PC you log the output of that line and then you know in which part of your code the infinite loop (or whatever produces the freeze) occurs.
OK I will make it but I think the problem comes of the generation of the web page and of library ethernet because it works one time and then after error of page.
Your assumptions may be right but even then you probably wanna know where the error occurs because it's easier to find if you know the region in the code where it stops.
What does "works one time and then after error of page" mean? Do you know the condition when it fails? Are you able to reproduce the failure?
It means that : The temperature displays on a page web and after few hours it does'nt display (error page). Then it can display again (without reset). Maybe it can come from the network which requests my arduino + ethernet shield in order to display a graph of these temperatures. I don't know.