 
-#include <Ethernet2.h>
+#include <Ethernet.h>
 #include <EthernetClient.h>
 #include <EthernetServer.h>
 #include <SPI.h>
+#include <EEPROMex.h>
+#include <EEPROMVar.h>
+
+//used to save the output state: 1 bit for output pin
+EEPROMClassEx mem;
 
 //number of pins used (equals for input and output)
-#define numPin 6
-byte output_pins[] = //insert array output pin es.{2,3,4,5,6,7}
-byte input_pins[] = // insert array input pin es.{14,15,16,17,18,19}
-
-byte mac[] = //insert MAC
-String my_mac= //insert MAC as String es. "90-A2-DA-10-21-A9"
+#define numPin 
+byte output_pins[] = {}; //insert array output pin es.{2,3,4,5,6,7}
+byte input_pins[] = {}; // insert array input pin es.{14,15,16,17,18,19}
+
+byte mac[]={}; //insert MAC
+String my_mac=""; //insert MAC as String es. "90-A2-DA-10-21-A9"
 
 
 IPAddress ip();  //insert ip for this shield


String request;

void setup() {
  Serial.begin(9600);
  for(int i=0;i<numPin;i++){
    pinMode(output_pins[i],OUTPUT);
    pinMode(input_pins[i],INPUT);
  }
  
  pinMode(10, OUTPUT); //pin ETHCS
  digitalWrite(10,HIGH); //impostiamo il pin ETHCS al valore alto per evitare problemi al caricamento della pagina
  
  Ethernet.begin(mac, ip);
  server.begin();
  // give the Ethernet shield a second to initialize:

        }
      }
    }
    // save the current output state on EEPROM every 10 seconds
    if(millis()-lastTime>10000){
      for(int i=0;i<numPin;i++){
        int address = i/8;
        byte pos = i%8;
        if(digitalRead(output_pins[i])==HIGH){
          mem.updateBit(address, pos, 1);
        }
        else{
          mem.updateBit(address, pos, 0); 
        }
      }
      lastTime=millis();
    }
    delay(10);
}

