Web Based Garage Door opener?

Hi, i would like to make web based garage door opener. First of all let me say I'M new to all this, so please keep that in mind. The hardware part of this project in not a problem. I have a "Arduino Uno" with an "HanRun Ethernet Shield" and a 1channel 5v relay. I have it all setup and tested it with the "Blink" sketch, and it works fine. So my problem is writing a sketch to make it work the way i want. Here is a sketch I'M trying to modify to accomplish this:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);

EthernetServer server(80);

void setup()
{
  Serial.begin(9600);    
  pinMode(8, OUTPUT);    
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  
  EthernetClient client = server.available();
  if (client) {
    boolean currentLineIsBlank = true;
    String buffer = "";  
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print(c);   
        buffer+=c;       
        if (c == '\n' && currentLineIsBlank) {
          
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          if (digitalRead(8)){
            client.print(" LED is <font color='green'>ON</font>");
          }else{
            client.print(" DOOR is <font color='red'>OFF</font>");
          }
          client.println("
");
          
          
          client.print("<FORM action=\"http://192.168.1.177/\" >");
          client.print("<P> <INPUT type=\"radio\" name=\"status\" value=\"1\">OPEN");
          client.print("<P> <INPUT type=\"radio\" name=\"status\" value=\"0\">CLOSED");
          client.print("<P> <INPUT type=\"submit\" value=\"Submit\"> </FORM>");
            
          break;
        }
        if (c == '\n') {
          
          currentLineIsBlank = true;
          buffer="";       
        } else if (c == '\r') {            
          if(buffer.indexOf("GET /?status=1")>=0)
            digitalWrite(8,HIGH);  
          
          if(buffer.indexOf("GET /?status=0")>=0)
            digitalWrite(8,LOW);  
        }
        else {
          
          currentLineIsBlank = false;
        }
      }
    }
    
    delay(1);
    
    client.stop();
  }
}

So instead of turning on or off the relay i need it to turn on for a second then automatically turn back off. Can someone please change that part of the code to accomplish this. I been researching for days to get this far, but know im just stuck. Any help would be greatly appreciated, Thank You.

I changed my mind on the code, so modified it in the topic. But I'M still stuck on how to make each radio button go to high for a sec then back to low. Can someone please help me out?

Why do you want a web based opener? Is this to replace the discrete opener in your car?

The problem is that you need a sensor to determine if the Garage is open or closed to provide context to the form submission. Without it, all you can have is a "toggle" button that will simulate the button press. Doing that requires adding only two lines to your "turn on" logic: a small to delay and a digitalWrite to take the pin back to LOW.

CrossRoads:
Why do you want a web based opener? Is this to replace the discrete opener in your car?

Well its not really for a garage door, its for a gate opener but its the same principle. I just said that it was a garage door to simplify things, as I'm sure a garage door opener is more common then a gate opener. I know its silly.

Arrch:
The problem is that you need a sensor to determine if the Garage is open or closed to provide context to the form submission. Without it, all you can have is a "toggle" button that will simulate the button press. Doing that requires adding only two lines to your "turn on" logic: a small to delay and a digitalWrite to take the pin back to LOW.

Ok that makes sense and I can deal with that for now. I would like to add a sensor but the problem is the gate is over 400ft away from the house. I have a remote wire under ground going out to the gate and adding another wire would be a real problem as far as I can see. The problem is the wire has to crossover the driveway to get to the house from the gate. This means digging under the driveway and I'm not about to do that again, unless their is another option to add a sensor without having to run another wire. I don't think wireless is an option because even the wireless remote that it came with can't reach from the house to the gate (lots of trees and bushes in the way). So I'm open to alternate options of adding a sensor if someone has them. But anyways I updated the code with a "delay and a digitalWrite" and it works but their is a small problem. Because now the state always returns to "LOW" so it always displays "Closed". How can i have the display still change with each button press? I know that both buttons now do the same thing, but if the status changed with each button press it would be a way of keeping track of the current position of the gate. I know this is not the ideal way of doing this, but like i said I'm new to all this and I'm learning as I go. Over time I would definitely like to improve this setup and make it more ideal, but for now I would be happy with anything. Here is the updated code.

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);

EthernetServer server(80);

void setup()
{
  Serial.begin(9600);    
  pinMode(8, OUTPUT);    
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  
  EthernetClient client = server.available();
  if (client) {
    boolean currentLineIsBlank = true;
    String buffer = "";  
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print(c);   
        buffer+=c;       
        if (c == '\n' && currentLineIsBlank) {
          
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          if (digitalRead(8)){  
            client.print(" GATE is <font color='green'>OPEN</font>");
          }else{
            client.print(" GATE is <font color='red'>CLOSED</font>");
          }
          client.println("
");
          
          
          client.print("<FORM action=\"http://192.168.1.177/\" >");
          client.print("<P> <INPUT type=\"radio\" name=\"status\" value=\"1\">OPEN");
          client.print("<P> <INPUT type=\"radio\" name=\"status\" value=\"0\">CLOSE");
          client.print("<P> <INPUT type=\"submit\" value=\"Submit\"> </FORM>");
            
          break;
        }
        if (c == '\n') {
          
          currentLineIsBlank = true;
          buffer="";       
        } else if (c == '\r') {            
          if(buffer.indexOf("GET /?status=1")>=0)
            digitalWrite(8,HIGH);  
            delay(100);
            digitalWrite(8,LOW);
  
          if(buffer.indexOf("GET /?status=0")>=0)
            digitalWrite(8,HIGH);
            delay(100);
            digitalWrite(8,LOW);
        }
        else {
          
          currentLineIsBlank = false;
        }
      }
    }
    
    delay(1);
    
    client.stop();
  }
}

It would help to know what sort of wiring you already have in place, and how the actuator is driven.

The sort of thing I'm envisaging now is a simple high/low signal over the existing wiring to control whether the gate should be open or closed, and a simple hardware circuit (relays, limit switches) to make the gate open and close depending on that state. You would design it so that any break in the circuit, power supply failure etc made the gate go to the safest state (I'm guess that would be closed, so you'd send a positive voltage to open the gate and nothing to close it). With this approach, the Arduino doesn't need to explicitly read whether the gate is open or closed, it can just assume that it is in whatever state the Arduino has demanded.

Without knowing what you have at the gate, try mounting a latching relay at the gate that operates when the gate is open. Use the contacts of the relay to reverse the polarity of the leads going back to the house. Then you can test for the polarity of the leads to give you the state of gate (open/closed). The push button at the house only closes the loop thus doesn't care what the polarity is.

It may be possible to pass more than one signal over the same wire depending on what is on that wire to being with. That is why we need to know what the wire is currently doing (how manhy wires, etc..)