Arduino uno Ethernet aziona telecomando luci giardino

Salve a tutti.
il mio obiettivo: ho un telecomando 433mhz che aziona le luci del giardino. spesso non si trova o non ne abbiamo molti a disposizione, quindi pensavo ad un arduino con ethernet collegato al router con ip statico in modo che noi familiari potremmo utilizzare il nostro cellulare per azionare il telecomando collegato all'arduino stesso.

ho trovato in rete uno sketch che però mantiene accesso il pin fino a quando non ri ripreme il pulsante. ma io ho la necessità che dopo 3 secondi , il pin non venga più alimentato.

questo lo sketch originale:

#include <EtherCard.h>

#define LED1PIN  2 //definisce il pin del LED 1
#define LED2PIN  3 //definisce il pin del LED 2

//settaggio dei valori statici
static byte mymac[] = {0x00,0x19,0xCB,0xF4,0x03,0x01};
static byte myip[] = {192,168,1,120};
static byte gwip[] = {192,168,1,1};
static byte netmask[] = {255,255,255,0};
static byte dnsip[] = {8,8,8,8};
byte Ethernet::buffer[700];

boolean led1Status;
boolean led2Status;

void setup () {
 
  Serial.begin(57600);
  Serial.println("WebRele' Ip Statico");
 
  if (!ether.begin(sizeof Ethernet::buffer, mymac, 10))
    Serial.println( "Accesso fallito all'Ethernet Shield");
 else
   Serial.println("Ethernet Shield initializzato");
 
  if (!ether.staticSetup(myip, gwip, dnsip, netmask ))
    Serial.println("Impossibile assegnare l'indirizzo");
  else
    Serial.println("Indirizo statico configurato");
    
  ether.printIp("IP Address:\t", ether.myip);
  ether.printIp("Netmask:\t", ether.netmask);
  ether.printIp("Gateway:\t", ether.gwip);
  ether.printIp("DNS:\t\t", ether.dnsip);
   Serial.println();
  
  pinMode(LED1PIN, OUTPUT);
  pinMode(LED2PIN, OUTPUT);
  
  digitalWrite(LED1PIN, LOW);
  digitalWrite(LED2PIN, LOW);
  
  led1Status = false;
  led2Status = false;  
}
  
void loop() {
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  
  if(pos) {
    
      if(strstr((char *)Ethernet::buffer + pos, "GET /?RELAY1") != 0) {
        led1Status = !led1Status;
        digitalWrite(LED1PIN, led1Status);
        Serial.println("Ricevuto comando per Rele' 1");  
      }
      
      if(strstr((char *)Ethernet::buffer + pos, "GET /?RELAY2") != 0) {
        led2Status = !led2Status;
        digitalWrite(LED2PIN, led2Status);
        Serial.println("Ricevuto comando per Rele' 2");        
      }
      
      BufferFiller bfill = ether.tcpOffset();
      bfill.emit_p(PSTR("HTTP/1.0 200 OK\r\n"
                        "Content-Type: text/html\r\nPragma: no-cache\r\n\r\n"
                        "<html><head><meta name='viewport' content='width=200px'/></head><body>"
                        "<div style='position:absolute;width:200px;height:200px;top:1%;left:50%;margin:5px 0 0 -100px'>"
                        "<div style='font:bold 18px verdana;text-align:center'>Web Rele'</div>"
                        "
<div style='text-align:center'>"));

      if(led1Status) bfill.emit_p(PSTR("<a href=\"/?RELAY1\"><img src=\"http://www.byte4geek.com/images/arduino/butON.png\"></a>
Stato Rele' 1 OFF
"));
      else bfill.emit_p(PSTR("<a href=\"/?RELAY1\"><img src=\"http://www.byte4geek.com/images/arduino/butOFF.png\"></a>
Stato rele' 1 ON
"));
      
      if(led2Status) bfill.emit_p(PSTR("
<a href=\"/?RELAY2\"><img src=\"http://www.byte4geek.com/images/arduino/butON.png\"></a>
Stato Rele' 2 OFF"));
      else bfill.emit_p(PSTR("
<a href=\"/?RELAY2\"><img src=\"http://www.byte4geek.com/images/arduino/butOFF.png\"></a>
Stato rele' 2 ON"));      

      bfill.emit_p(PSTR("
<a href=\"/\">Controlla lo stato dei Rele'</a></div></div></body></html>"));
      ether.httpServerReply(bfill.position());
   }
  }

ho provato a fare diverse modifiche ma non ho avuto grandi risultati, in pratica il led si spegne dopo 3 secondi, ma poi esegue una seconda accenzione.

void loop() {
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);
  
  if(pos) {
    
      if(strstr((char *)Ethernet::buffer + pos, "GET /?RELAY1") != 0) {
        digitalWrite(LED1PIN, HIGH);
        delay(3000);
        digitalWrite(LED1PIN, LOW);
        delay(1000);
        Serial.println("Ricevuto comando per azionare luci posteriori");  
      }
      
      if(strstr((char *)Ethernet::buffer + pos, "GET /?RELAY2") != 0) {
        led2Status = !led2Status;
        digitalWrite(LED2PIN, led2Status);
        delay(3000);
        digitalWrite(LED2PIN, false);
        delay(1000);
        Serial.println("Ricevuto comando per azionare le luci anteriori");        
      }

non riesco a capacitarmi. forse non è lo sketch giusto..

grazie

up