mi ero dimenticato di mettere il codice iniziale
#include <SPI.h>
#include <Ethernet.h>
#include <ICMPPing.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0x90, 0xA2, 0xDA, 0x0D, 0x93, 0x70 };
IPAddress ip(192,168,1, 183);
IPAddress sub(255,255,255,0);
IPAddress gw(192,168,1, 5);
SOCKET pingSocket = 1;
int WAIT_TO_RESET = 10; //numero di tentativi falliti dopo il quale si effettua lo shutdown della porta !
int PING_FAIL = 0;
int DELAY_PING = 0; //variabile per il controllo del delay del loop principale
int DELAY_CEHCK_PING = 5000; // ogni 5 secondi effettua un ping !!
int DELAY_OFF = 7000; //quanto deve tenere spento il canale
char STR_FAIL[] = "Timed Out";
byte pingAddr[] = {192,168,1,14};
char buffer [256];
EthernetServer server(80);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
//imposto i PIN out per la shield dei Relè
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
//imposto tutti i canali ACCESI
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gw, sub);
server.begin();
delay(100);
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}