I started a similar thread in Networking but I just figured out this has nothing to do with the network side of my code, rather than calling on freeRam() in conjunction with the network code.
using the example WiFi Web Server LED Blink I want someone to add this little code to it, and see if the free ram doesn't cause the arduino to crash in 7 minutes after the server code is called.
up top above setup add
unsigned long previousMillis=0;
int interval=30000;
unsigned long PrintCount=0;
unsigned long LoopCount=0;
next add this to loop()
void loop()
{
ListenForController();
unsigned long currentMillis = millis();
if(currentMillis - previousMillis >= interval) // print this every 2 seconds
{ previousMillis = currentMillis;
Serial.print(PrintCount);
Serial.print(F(" "));
Serial.print(LoopCount);
Serial.print(F(" "));
Serial.print(millis());
Serial.print(F(" "));
Serial.print(freeRam());
Serial.print(F(" "));
Serial.println(F("slave arduino // freezes"));
PrintCount++;
}
LoopCount++;
}void ListenForController()
{
then at the bottom add this
int freeRam() {
extern int __heap_start,*__brkval;
int v;
return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int) __brkval);
}
The results are if you never connect to the internet page, it will never freeze. However, if you connect to the internet page (if you only connect once) then it will freeze in 7 minutes after the connection due to some kind of cross code contamination witchery.