arduinoMega2560+ethernet-enc28j60-HTML trava e para de pingar

Olá Pessoal,
Arduino para de pingar e trava assim que é requisitada a pagina html via browser , escrevi o programa e funcionou, com 1 2 3 e 4 botões, porem precisava de 16 botões, pra controlar 16 reles, assim que o html aumenta e passa dos 4 primeiras series de botões o programa para de funcionar, segue código:

programa parte 1:

#include <EtherCard.h>
//DANIEL DIAS SILVA - PROGRAMACAO FONTE PRACA MANOEL LEITE LEMOS - DELFINOPOLIS-MG - DANIEL.DELFINOPOLIS@GMAIL.COM


static byte mymac[] = { 0x00,0x01,0x01,0x01,0x01,0x01  };
static byte myip[] = { 192,168,2,201 };
static byte mygw[] = { 192,168,2,1 };
static byte mydns[] = { 192,168,2,1 };
#define BUFFER_SIZE   1500
byte Ethernet::buffer[BUFFER_SIZE];
BufferFiller bfill;

#define RELAIS_1     31
#define RELAIS_2     33
#define RELAIS_3     35
#define RELAIS_4     37
#define RELAIS_5     39
#define RELAIS_6     41
#define RELAIS_7     43
#define RELAIS_8     45
#define RELAIS_9     30
#define RELAIS_10     32
#define RELAIS_11     34
#define RELAIS_12     36
#define RELAIS_13     38
#define RELAIS_14     40
#define RELAIS_15     42
#define RELAIS_16     44

long randNumber;
long randNumber2;
unsigned long tempo = millis();
int temporizador = 0;
int rele01 = 0;
int rele02 = 0;
int rele03 = 0;
int rele04 = 0;
int rele05 = 0;
int rele06 = 0;
int rele07 = 0;
int rele08 = 0;
int rele09 = 0;
int rele10 = 0;
int rele11 = 0;
int rele12 = 0;
int rele13 = 0;
int rele14 = 0;
int rele15 = 0;
int rele16 = 0;

const char http_OK[] PROGMEM =
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\n"
"Pragma: no-cache\r\n\r\n";

const char http_Found[] PROGMEM =
"HTTP/1.0 302 Found\r\n"
"Location: /\r\n\r\n";

const char http_Unauthorized[] PROGMEM =
"HTTP/1.0 401 Unauthorized\r\n"
"Content-Type: text/html\r\n\r\n"
"<h1>401 Unauthorized</h1>";

void homePage()
{
 bfill.emit_p(PSTR("$F"
   
   "<title>FONTE DELFINOPOLIS</title>
"
   "<form method=get name=form><center>"

   "BOMBA_1:<button name=relais001 value=on type=submit style=height:40px; width:150px> ON </button>"
   "<button name=relais001 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
   "<button name=relais001 value=off type=submit style=height:40px; width:150px> OFF </button>
"

   "BOMBA_2:<button name=relais002 value=on type=submit style=height:40px; width:150px> ON </button>"
   "<button name=relais002 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
   "<button name=relais002 value=off type=submit style=height:40px; width:150px> OFF </button>
"

   "BOMBA_3:<button name=relais003 value=on type=submit style=height:40px; width:150px> ON </button>"
   "<button name=relais003 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
   "<button name=relais003 value=off type=submit style=height:40px; width:150px> OFF </button>
"

   "BOMBA_4:<button name=relais004 value=on type=submit style=height:40px; width:150px> ON </button>"
  "<button name=relais004 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
   "<button name=relais004 value=off type=submit style=height:40px; width:150px> OFF </button>
"

//    "BOMBA_5:<button name=relais005 value=on type=submit style=height:40px; width:150px> ON </button>"
//    "<button name=relais005 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
//    "<button name=relais005 value=off type=submit style=height:40px; width:150px> OFF </button>
"
   
//    "BOMBA_6:<button name=relais006 value=on type=submit style=height:40px; width:150px> ON </button>"
//    "<button name=relais006 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
//    "<button name=relais006 value=off type=submit style=height:40px; width:150px> OFF </button>
"

//    "BOMBA_7:<button name=relais007 value=on type=submit style=height:40px; width:150px> ON </button>"
//    "<button name=relais007 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
//    "<button name=relais007 value=off type=submit style=height:40px; width:150px> OFF </button>
"

//    "LUZ_01:<button name=relais008 value=on type=submit style=height:40px; width:150px> ON </button>"
//    "<button name=relais008 value=aut type=submit style=height:40px; width:150px> AUTO </button>"
//    "<button name=relais008 value=off type=submit style=height:40px; width:150px> OFF </button>
"
     
  ),
  http_OK );
 }

programa parte 2:

void setup()
{
Serial.begin(115200);  
randomSeed(analogRead(A0));


pinMode(RELAIS_1, OUTPUT);
pinMode(RELAIS_2, OUTPUT);
pinMode(RELAIS_3, OUTPUT);
pinMode(RELAIS_4, OUTPUT);
pinMode(RELAIS_5, OUTPUT);
pinMode(RELAIS_6, OUTPUT);
pinMode(RELAIS_7, OUTPUT);
pinMode(RELAIS_8, OUTPUT);
pinMode(RELAIS_9, OUTPUT);
pinMode(RELAIS_10, OUTPUT);
pinMode(RELAIS_11, OUTPUT);
pinMode(RELAIS_12, OUTPUT);
pinMode(RELAIS_13, OUTPUT);
pinMode(RELAIS_14, OUTPUT);
pinMode(RELAIS_15, OUTPUT);
pinMode(RELAIS_16, OUTPUT);

digitalWrite(RELAIS_1, HIGH); 
digitalWrite(RELAIS_2, HIGH); 
digitalWrite(RELAIS_3, HIGH); 
digitalWrite(RELAIS_4, HIGH); 
digitalWrite(RELAIS_5, HIGH); 
digitalWrite(RELAIS_6, HIGH); 
digitalWrite(RELAIS_7, HIGH); 
digitalWrite(RELAIS_8, HIGH);
digitalWrite(RELAIS_9, HIGH); 
digitalWrite(RELAIS_10, HIGH); 
digitalWrite(RELAIS_11, HIGH); 
digitalWrite(RELAIS_12, HIGH); 
digitalWrite(RELAIS_13, HIGH); 
digitalWrite(RELAIS_14, HIGH); 
digitalWrite(RELAIS_15, HIGH); 
digitalWrite(RELAIS_16, HIGH);

if (ether.begin(BUFFER_SIZE, mymac, 53) == 0)
 Serial.println("Cannot initialise ethernet.");
  
else
  Serial.println("Ethernet initialised.");

ether.staticSetup(myip, mygw, mydns);
ether.printIp("IP:   ", ether.myip); // output IP address to Serial
ether.printIp("GW:   ", ether.gwip); // output gateway address to Serial
ether.printIp("DNS: ", ether.dnsip); // output DNS to Serial

}

void loop()
{


if (rele01 == 0) {digitalWrite(RELAIS_1, HIGH);}
          
else  if (rele01 == 1) {digitalWrite(RELAIS_1, LOW);}
else if (rele01==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_1, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_1, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
if (rele02 == 0) {digitalWrite(RELAIS_2, HIGH);}
          
else  if (rele02 == 1) {digitalWrite(RELAIS_2, LOW);}
else if (rele02==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_2, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_2, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
if (rele03 == 0) {digitalWrite(RELAIS_3, HIGH);}
          
else  if (rele03 == 1) {digitalWrite(RELAIS_3, LOW);}
else if (rele03==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_3, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_3, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
  if (rele04 == 0) {digitalWrite(RELAIS_4, HIGH);}
          
else  if (rele04 == 1) {digitalWrite(RELAIS_4, LOW);}
else if (rele04==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_4, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_4, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
  if (rele05 == 0) {digitalWrite(RELAIS_5, HIGH);}
          
else  if (rele05 == 1) {digitalWrite(RELAIS_5, LOW);}
else if (rele05==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_5, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_5, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
  if (rele06 == 0) {digitalWrite(RELAIS_6, HIGH);}
          
else  if (rele06 == 1) {digitalWrite(RELAIS_6, LOW);}
else if (rele06==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_6, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_6, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
  if (rele07 == 0) {digitalWrite(RELAIS_7, HIGH);}
          
else  if (rele07 == 1) {digitalWrite(RELAIS_7, LOW);}
else if (rele07==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_7, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_7, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///
  if (rele08 == 0) {digitalWrite(RELAIS_8, HIGH);}
          
else  if (rele08 == 1) {digitalWrite(RELAIS_8, LOW);}
else if (rele08==2){
  randNumber = random(2000, 5000);                  
  if (temporizador == 0) {digitalWrite(RELAIS_8, LOW); temporizador = 1; tempo = millis();}
      if (millis() - tempo >= randNumber && temporizador == 1) {digitalWrite(RELAIS_8, HIGH); temporizador = 2; tempo = millis();randNumber2 = random(1000, 3000);}
          if (millis() - tempo >= randNumber2 && temporizador == 2){temporizador = 0;}
}       
///

restante da programação parte 3:

///

 word len = ether.packetReceive();
 word pos = ether.packetLoop(len);
 
 if (pos) {
   bfill = ether.tcpOffset();
   char *data = (char *) Ethernet::buffer + pos;
   if (strncmp("GET /", data, 5) != 0) {
     // Unsupported HTTP request
     // 304 or 501 response would be more appropriate
     bfill.emit_p(http_Unauthorized);
   }
   else {
     Serial.print("----");
     Serial.print(data);
     Serial.println("----");
     data += 5;

     if (data[0] == ' ') {
       // Return home page
       homePage();
     }


     else if (strncmp("?relais001=on ", data, 14) == 0) {
       rele01 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais001=aut ", data, 15) == 0) {
       rele01 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais001=off ", data, 15) == 0) {
       rele01 = 0;
       bfill.emit_p(http_Found);
     }

     else if (strncmp("?relais002=on ", data, 14) == 0) {
       rele02 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais002=aut ", data, 15) == 0) {
       rele02 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais002=off ", data, 15) == 0) {
       rele02 = 0;
       bfill.emit_p(http_Found);
     }

      else if (strncmp("?relais003=on ", data, 14) == 0) {
       rele03 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais003=aut ", data, 15) == 0) {
       rele03 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais003=off ", data, 15) == 0) {
       rele03 = 0;
       bfill.emit_p(http_Found);
     }
     
      else if (strncmp("?relais004=on ", data, 14) == 0) {
       rele04 = 1;
       bfill.emit_p(http_Found); 
     }
      else if (strncmp("?relais004=aut ", data, 15) == 0) {
       rele04 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais004=off ", data, 15) == 0) {
       rele04 = 0;
       bfill.emit_p(http_Found);
     }

      else if (strncmp("?relais005=on ", data, 14) == 0) {
       rele05 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais005=aut ", data, 15) == 0) {
       rele05 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais005=off ", data, 15) == 0) {
       rele05 = 0;
       bfill.emit_p(http_Found);
     }

      else if (strncmp("?relais006=on ", data, 14) == 0) {
       rele06 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais006=aut ", data, 15) == 0) {
       rele06 = 2;
       bfill.emit_p(http_Found);
     }
     else if (strncmp("?relais006=off ", data, 15) == 0) {
       rele06 = 0;
       bfill.emit_p(http_Found);
     }

      else if (strncmp("?relais007=on ", data, 14) == 0) {
       rele07 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais007=aut ", data, 15) == 0) {
       rele07 = 2;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais007=off ", data, 15) == 0) {
       rele07 = 0;
       bfill.emit_p(http_Found);
     }
     
      else if (strncmp("?relais008=on ", data, 14) == 0) {
       rele08 = 1;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais008=aut ", data, 15) == 0) {
       rele08 = 2;
       bfill.emit_p(http_Found);
     }
      else if (strncmp("?relais008=off ", data, 15) == 0) {
       rele08 = 0;
       bfill.emit_p(http_Found);
     }
     ///
     
     else {
       // Page not found
       bfill.emit_p(http_Unauthorized);
     }

     
   }

   ether.httpServerReply(bfill.position());    // send http response
 }
}
//}