My sketch freeze

Hello Everyone

I´ve got a big problem with my datalogger (Arduino Ethernet, included RTC 1307. After about 4-6 hours the datalogger freeze. I assumed that it´s when the Arduino are writing to the SD card.
Can everyone tell me what´s wrong?? (I´ve got about 188 Byte of ram free, all the time, when the datalogger are running.)

The Arduino code is included in this post.

Datalogger.txt (11.1 KB)

Have you tried moving your constant strings like client.println("Content-Type: text/html"); into program memory?
That would free-up a fair amount of RAM.

Can you give an example, how to do ?? I pretty new into this programming...

Anyways thanks for help :)

Try using the F() macro.


client.println("Content-Type: text/html");


client.println(F("Content-Type: text/html"));

I will try.

What happens with the F macro ??

What happens with the F macro ??

It puts the associated string into program memory, so saving RAM.

WOAV. I doubled the free memory from 188 byte to 405 byte. I hope this helps

It may help, or it may just delay the inevitable. Without having your exact environment and code, it is difficult to say what will happen Does the amount of free RAM remain relatively constant over time?

int unsigned long lastmillis1;

That doesn't look good.

I´m using the:

Serial.print(FreeRam()); // Show free memory

to print the free memory, but I don´t know if this update? it stays at the same value all over the project until it freeze.

You can see my code, that is attached to my first post.

about the int unsigned long, it dosen´t complain about it. Should I remove the "int" ??

but I don´t know if this update? i

It looks like it should update whenever you press the button.

Yes, you should really remove the "int".

Really many thanks for helping me!!!! I hope this solved the problem.